This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients Julian, Philip Dye, anthony shaw, anthonypjshaw, benjamin.peterson, levkivskyi, louielu, serhiy.storchaka
Date 2020-03-28.14:46:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1585406814.54.0.821955725136.issue15987@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-03-28 14:46:54serhiy.storchakasetrecipients: + serhiy.storchaka, benjamin.peterson, Julian, levkivskyi, louielu, anthonypjshaw, anthony shaw, Philip Dye
2020-03-28 14:46:54serhiy.storchakasetmessageid: <1585406814.54.0.821955725136.issue15987@roundup.psfhosted.org>
2020-03-28 14:46:54serhiy.storchakalinkissue15987 messages
2020-03-28 14:46:53serhiy.storchakacreate