[issue37792] xml.etree.ElementTree.Element.__eq__ does compare only objects identity

Marco Sulla report at bugs.python.org
Thu Aug 22 02:04:02 EDT 2019


Marco Sulla <launchpad.net at marco.sulla.e4ward.com> added the comment:

@rhettinger:

"Deprecating [...] just cause disruption to existing, deployed code"

How? Deprecating is used just to maintain intact the already existing code...

"Please do not go down of the path of making yourself the arbiter of what is Pythonic or standard.  The other core devs in this conversation are highly experienced.  Insulting them or the Fredrik Lundh's existing API won't help matters"

I'm not insulting anyone, I just said *IMHO* it's not pythonic. 

I think the example of a tree created with a simple dictionary is a clear signal that Python, in the Guido's mind, was created with the intention that equality should check the content of the objects and not just the ids, as Java, for example, does, even for objects that must be traversed to see if they are equal to another one.

The fact you can check if two objects are equal using simply == is, _IMHO_, more elegant, simple and useful. The fact that == checks the ids is not useful at all, since I can do it with id(elem1) == id(elem2). So what's the purpose of == ?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37792>
_______________________________________


More information about the Python-bugs-list mailing list