Message349230
| 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:04 | Marco Sulla | set | recipients:
+ Marco Sulla |
| 2019年08月08日 09:57:04 | Marco Sulla | set | messageid: <1565258224.48.0.98423013878.issue37792@roundup.psfhosted.org> |
| 2019年08月08日 09:57:04 | Marco Sulla | link | issue37792 messages |
| 2019年08月08日 09:57:04 | Marco Sulla | create |
|