[issue15987] Provide a way to compare AST nodes for equality recursively

2020-03-28 Thread Batuhan Taskaya
Change by Batuhan Taskaya : -- pull_requests: +18574 pull_request: https://github.com/python/cpython/pull/19211 ___ Python tracker ___

[issue15987] Provide a way to compare AST nodes for equality recursively

2020-03-28 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: The solution to hashing used in PR 14970 was just using the default hashing function which is kind of a workaround to the real problem. I now concur with your comments. Will try to draft out an `ast.compare` function. -- nosy: +BTaskaya

[issue15987] Provide a way to compare AST nodes for equality recursively

2020-03-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I am not sure that implementing a rich comparison of AST nodes is the right way. There are too much options (compare attributes or not, compare recursively or not, compare types or not) and __eq__ does not support options. In addition, it requires

[issue15987] Provide a way to compare AST nodes for equality recursively

2020-01-28 Thread Brett Cannon
Change by Brett Cannon : -- nosy: -brett.cannon ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue15987] Provide a way to compare AST nodes for equality recursively

2019-08-07 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: > If consensus has been reached on this, I am willing to do the work. It looks like there is already an active PR https://github.com/python/cpython/pull/14970, there are some non-implemented comments from a core review. --

[issue15987] Provide a way to compare AST nodes for equality recursively

2019-07-29 Thread STINNER Victor
Change by STINNER Victor : -- nosy: -vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue15987] Provide a way to compare AST nodes for equality recursively

2019-07-27 Thread Philip Dye
Philip Dye added the comment: If consensus has been reached on this, I am willing to do the work. -- nosy: +Philip Dye ___ Python tracker ___

[issue15987] Provide a way to compare AST nodes for equality recursively

2019-07-26 Thread Flavian Hautbois
Change by Flavian Hautbois : -- keywords: +patch pull_requests: +14739 stage: resolved -> patch review pull_request: https://github.com/python/cpython/pull/14970 ___ Python tracker

[issue15987] Provide a way to compare AST nodes for equality recursively

2019-05-10 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: Btw, I am +1 on this feature (preferably with an option to check line, column, end line, and end column). I always wanted this, but never had time to actually implement this. -- nosy: +levkivskyi ___ Python

[issue15987] Provide a way to compare AST nodes for equality recursively

2019-05-09 Thread STINNER Victor
Change by STINNER Victor : -- versions: +Python 3.8 -Python 3.4 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue15987] Provide a way to compare AST nodes for equality recursively

2019-05-06 Thread STINNER Victor
STINNER Victor added the comment: Please don't close an issue too fast. The PR 1368 is still open and contains valuable code. Moreover, I don't see anyone here saying that the feature is a bad idea. The feature has not been implemented, so the issue should remain open, even if PR 1368 is

[issue15987] Provide a way to compare AST nodes for equality recursively

2019-05-06 Thread anthony shaw
anthony shaw added the comment: Closing issue, PR branch has since been removed and targets Python 3.4 -- nosy: +anthonypjshaw resolution: -> out of date stage: test needed -> resolved status: open -> closed ___ Python tracker

[issue15987] Provide a way to compare AST nodes for equality recursively

2019-05-06 Thread anthony shaw
anthony shaw added the comment: This discussion is inconclusive and targets an old version of CPython, can this issue be closed? -- nosy: +anthony shaw ___ Python tracker

[issue15987] Provide a way to compare AST nodes for equality recursively

2017-05-02 Thread Louie Lu
Changes by Louie Lu : -- pull_requests: +1483 ___ Python tracker ___ ___ Python-bugs-list

[issue15987] Provide a way to compare AST nodes for equality recursively

2017-05-02 Thread Louie Lu
Louie Lu added the comment: Update to AST base type richcompare. the unittest finished time was better than python version: Ran 7 tests in 0.278s -- ___ Python tracker

[issue15987] Provide a way to compare AST nodes for equality recursively

2017-05-01 Thread Louie Lu
Louie Lu added the comment: Provide a recursive way to compare AST nodes, it will compare with fields, but no attributes. The performance compare with ast.dump methods in unittest # Recursive compare ./python -m unittest test.test_ast.ASTCompareTest ..

[issue15987] Provide a way to compare AST nodes for equality recursively

2017-05-01 Thread Louie Lu
Changes by Louie Lu : -- pull_requests: +1477 ___ Python tracker ___ ___ Python-bugs-list

[issue15987] Provide a way to compare AST nodes for equality recursively

2017-05-01 Thread Louie Lu
Louie Lu added the comment: If we only need a binary True/False result, could we just return a compare of dump(a) == dump(b)? This can also add the include_attributes flags for need. -- nosy: +louielu ___ Python tracker

[issue15987] Provide a way to compare AST nodes for equality recursively

2013-03-26 Thread Brett Cannon
Brett Cannon added the comment: I have a use for this as well, but w/o the lineno/col_offset comparison and all I need is a True/False result. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15987

[issue15987] Provide a way to compare AST nodes for equality recursively

2013-03-26 Thread Brett Cannon
Brett Cannon added the comment: IOW I think a function that uses ast.walk() and has flags for specifying whether _attributes should also be checked and then uses a class check and then uses _fields to do all other checking. -- ___ Python tracker

[issue15987] Provide a way to compare AST nodes for equality recursively

2012-09-22 Thread Benjamin Peterson
Benjamin Peterson added the comment: Yes, though some things like what to return if one has an entire subtree that the other doesn't have will have to be worked out. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15987

[issue15987] Provide a way to compare AST nodes for equality recursively

2012-09-21 Thread Brett Cannon
Changes by Brett Cannon br...@python.org: -- nosy: +brett.cannon ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15987 ___ ___ Python-bugs-list

[issue15987] Provide a way to compare AST nodes for equality recursively

2012-09-21 Thread Benjamin Peterson
Benjamin Peterson added the comment: This is a reasonable request. Should comparison include lineno/col_offset or not? If you implement, __eq__, you should also implement __hash__. Maybe, it would be best to start with a helper comparison function in the ast module. -- nosy:

[issue15987] Provide a way to compare AST nodes for equality recursively

2012-09-21 Thread Julian Berman
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

[issue15987] Provide a way to compare AST nodes for equality recursively

2012-09-21 Thread Terry J. Reedy
Changes by Terry J. Reedy tjre...@udel.edu: -- stage: - test needed versions: -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15987 ___

[issue15987] Provide a way to compare AST nodes for equality recursively

2012-09-20 Thread Julian Berman
New submission from Julian Berman: As is, as far as I can tell, there's no way to easily compare two AST nodes to see if they have the same children and same fields (recursively). I'm writing some unit tests for a NodeTransformers, so I've settled for comparing `ast.dump()`s of each, which is

[issue15987] Provide a way to compare AST nodes for equality recursively

2012-09-20 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15987 ___ ___ Python-bugs-list