[issue15987] Provide a way to compare AST nodes for equality recursively
Julian Berman
report at bugs.python.org
Fri Sep 21 20:12:14 CEST 2012
Julian Berman added the comment:
I'd say yes (to both lineno/col_offset). And yeah that sounds like what I had in mind (a helper function).
If I'm specific for a moment about implementation, perhaps something like `ast.diff`, which yielded tuples of differing nodes (in say, breadth first order down the tree) from two given nodes, and took args for configuration, compare_lineno and compare_col_offset (both defaulted to True), and then __eq__ was just `next(ast.diff(self, other, compare_lineno=True, compare_col_offset=True), None) is None`.
Sound good to you?
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15987>
_______________________________________
More information about the Python-bugs-list
mailing list