Message139291
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? |
|
Date |
User |
Action |
Args |
2011-06-27 15:00:52 | smarnach | set | recipients:
+ smarnach, gvanrossum, barry, rhettinger, mark.dickinson, christian.heimes, mikecurtis |
2011-06-27 15:00:51 | smarnach | set | messageid: <1309186851.9.0.389222293539.issue4296@psf.upfronthosting.co.za> |
2011-06-27 15:00:51 | smarnach | link | issue4296 messages |
2011-06-27 15:00:51 | smarnach | create | |
|