Serhiy Storchaka <storchaka+cpyt...@gmail.com> 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 implementing compatible __hash__, but how do you implement a hash 
of mutable object? In addition, recursive comparison can introduce a regression 
in existing code -- instead of fast returning False the comparison will spent a 
nontrivial amount of time.

If implement a comparison of AST nodes, it should be a separate function which 
support multiple options. Would be nice also to have examples where this 
feature can be used before implementing it.

See also issue37792.

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue15987>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to