Am 07.07.2014 17:15, schrieb Benjamin Peterson:
On Mon, Jul 7, 2014, at 04:22, Andreas Maier wrote:

Python 2.x does not seem to have such a default implementation; == and
!= raise an exception if attempted on objects that don't implement
equality in derived classes.

Why do you think that?

Because I looked at the source code of try_rich_compare() in object.c of the 2.7 stream in the repository. Now, looking deeper into that module, it turns out there is a whole number of variations of comparison functions, so maybe I looked at the wrong one.

Instead of trying to figure out how they are called, it is probably easier to just try it out, as you did. Your example certainly shows that == between instances of type object returns a value.

So the Python 2.7 implementation shows the same discrepancy as Python 3.x regarding the == and != default implementation.

Does anyone know why?

Andy


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to