Message365213
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. |
|
Date |
User |
Action |
Args |
2020-03-28 14:46:54 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, benjamin.peterson, Julian, levkivskyi, louielu, anthonypjshaw, anthony shaw, Philip Dye |
2020-03-28 14:46:54 | serhiy.storchaka | set | messageid: <1585406814.54.0.821955725136.issue15987@roundup.psfhosted.org> |
2020-03-28 14:46:54 | serhiy.storchaka | link | issue15987 messages |
2020-03-28 14:46:53 | serhiy.storchaka | create | |
|