This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients Alexander Todorov, barry, docs@python, steven.daprano
Date 2017-03-08.15:01:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1488985317.79.0.112661931752.issue29756@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-03-08 15:01:57steven.dapranosetrecipients: + steven.daprano, barry, docs@python, Alexander Todorov
2017-03-08 15:01:57steven.dapranosetmessageid: <1488985317.79.0.112661931752.issue29756@psf.upfronthosting.co.za>
2017-03-08 15:01:57steven.dapranolinkissue29756 messages
2017-03-08 15:01:57steven.dapranocreate