Author smarnach
Recipients barry, christian.heimes, gvanrossum, mark.dickinson, mikecurtis, rhettinger, smarnach
Date 2011-06-27.15:00:51
SpamBayes Score 2.07428e-08
Marked as misclassified No
Message-id <1309186851.9.0.389222293539.issue4296@psf.upfronthosting.co.za>
In-reply-to
Content
The behaviour discussed in this thread does not seem to be reflected in Python's documentation.  The documentation of __eq__() [1] doesn't mention that objects should compare equal to themselves.

 [1]: http://docs.python.org/dev/reference/datamodel.html#object.__eq__

There are several places in the documentation that are wrong for NaNs; just one example is the documentation of sequence types [2], which states:

> This means that to compare equal, every element must compare equal
> and the two sequences must be of the same type and have the same
> length.

 [2]: http://docs.python.org/dev/library/stdtypes.html#sequence-types-str-bytes-bytearray-list-tuple-range

It's probably not worthwhile to "fix" all the places in the documentation that implicitly assume that objects compare equal to themselves, but it probably is a good idea to mention that __eq__() implementations should fulfil this assumption to avoid strange behaviour when used in combination with standard containers.  Any thoughts?
History
Date User Action Args
2011-06-27 15:00:52smarnachsetrecipients: + smarnach, gvanrossum, barry, rhettinger, mark.dickinson, christian.heimes, mikecurtis
2011-06-27 15:00:51smarnachsetmessageid: <1309186851.9.0.389222293539.issue4296@psf.upfronthosting.co.za>
2011-06-27 15:00:51smarnachlinkissue4296 messages
2011-06-27 15:00:51smarnachcreate