[docs] [issue29756] Improve documentation for list methods that compare items by equality

Josh Rosenberg report at bugs.python.org
Wed Mar 8 10:35:23 EST 2017


Josh Rosenberg added the comment:

Steven: Technically, in CPython, they use both identity and equality testing, as a function of using RichCompareBool (which tests identity first, then equality), rather than RichCompare (which only tests equality).

It makes a difference for stuff like NaN values, where describing it as equality only would imply that:

nan = float('nan')
([nan] * 10).count(nan)

produces 0 (because nan is equal to nothing, including itself), when in fact it produces 10 (because we reused the same nan object, and the identity test passed).

----------
nosy: +josh.r

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29756>
_______________________________________


More information about the docs mailing list