(self, lhs, rhs, vars=())
| 174 | """ |
| 175 | |
| 176 | def __init__(self, lhs, rhs, vars=()): |
| 177 | if not isinstance(vars, tuple): |
| 178 | raise TypeError("vars must be a tuple of variables") |
| 179 | self.lhs = lhs |
| 180 | if callable(rhs): |
| 181 | self.subs = rhs |
| 182 | else: |
| 183 | self.subs = self._apply |
| 184 | self.rhs = rhs |
| 185 | self._varlist = [t for t in Traverser(lhs) if t in vars] |
| 186 | # Reduce vars down to just variables found in lhs |
| 187 | self.vars = tuple(sorted(set(self._varlist))) |
| 188 | |
| 189 | def _apply(self, sub_dict): |
| 190 | term = self.rhs |