Check if self contains other.
(self, other)
| 713 | raise NotImplementedError(f'traverse method for {self.op}') |
| 714 | |
| 715 | def contains(self, other): |
| 716 | """Check if self contains other. |
| 717 | """ |
| 718 | found = [] |
| 719 | |
| 720 | def visit(expr, found=found): |
| 721 | if found: |
| 722 | return expr |
| 723 | elif expr == other: |
| 724 | found.append(1) |
| 725 | return expr |
| 726 | |
| 727 | self.traverse(visit) |
| 728 | |
| 729 | return len(found) != 0 |
| 730 | |
| 731 | def symbols(self): |
| 732 | """Return a set of symbols contained in self. |