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 Marco Sulla
Recipients Marco Sulla
Date 2019-08-08.09:57:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1565258224.48.0.98423013878.issue37792@roundup.psfhosted.org>
In-reply-to
Content
Currectly, even if two `Element`s elem1 and elem2 are different objects but the tree is identical, elem1 == elem2 returns False. The only effective way to compare two `Element`s is

ElementTree.tostring(elem1) == ElementTree.tostring(elem2)

Furthermore, from 3.8 this could be not true anymore, since the order of insertion of attributes will be preserved. So if I simply wrote a tag with two identical attributes, but with different order, the trick will not work anymore.

Is it so much complicated to implement an __eq__ for `Element` that traverse its tree?

PS: some random remarks about xml.etree.ElementTree module:

1. why `fromstring` and `fromstringlist` separated functions? `fromstring` could use duck typing for the main argument, and `fromstringlist` deprecated.

2. `SubElement`: why the initial is a capital letter? It seems the constructor of a different class, while it's a factory function. I'll change it to `subElement` and deprecate `SubElement`
History
Date User Action Args
2019-08-08 09:57:04Marco Sullasetrecipients: + Marco Sulla
2019-08-08 09:57:04Marco Sullasetmessageid: <1565258224.48.0.98423013878.issue37792@roundup.psfhosted.org>
2019-08-08 09:57:04Marco Sullalinkissue37792 messages
2019-08-08 09:57:04Marco Sullacreate