[Python-Dev] == on object tests identity in 3.x (original) (raw)

Steven D'Aprano steve at pearwood.info
Tue Jul 8 03:58:33 CEST 2014


On Mon, Jul 07, 2014 at 04:52:17PM -0700, Ethan Furman wrote:

On 07/07/2014 04:49 PM, Benjamin Peterson wrote: > >Probably the best argument for the behavior is that "x is y" should >imply "x == y", which preludes raising an exception. No such invariant >is desired for ordering, so default implementations of < and > are not >provided in Python 3.

Nice. This bit should definitely make it into the doc patch if not already in the docs.

However, saying this should not preclude classes where this is not the case, e.g. IEEE-754 NANs. I would not like this wording (which otherwise is very nice) to be used in the future to force reflexivity on object equality.

https://en.wikipedia.org/wiki/Reflexive_relation

To try to cut off arguments:

-- Steven



More information about the Python-Dev mailing list