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

Steven D'Aprano added the comment:
Further to Barry's explanation, you see the same result with any values which compare equal:
py> from decimal import Decimal as D py> [1, 1.0, D(1), True, 1+0j].count(D(1)) 5
This is standard behaviour for methods `count`, `remove`, and `index`, but it isn't explained well in the documentation. E.g. `remove` says "Remove the first item from the list whose value is x` which could be read as meaning that the test is done by identity. All three methods need to clarify that ordinary == equality is used.
I'm going to re-open the task as a documentation issue.
---------- assignee: -> docs@python components: +Documentation nosy: +docs@python, steven.daprano resolution: not a bug -> stage: resolved -> status: closed -> open title: List count() counts True as 1 -> Improve documentation for list methods that compare items by equality type: -> enhancement versions: -Python 2.7, Python 3.5
_______________________________________ Python tracker report@bugs.python.org http://bugs.python.org/issue29756 _______________________________________
participants (1)
-
Steven D'Aprano