Message289239
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. |
|
Date |
User |
Action |
Args |
2017-03-08 15:01:57 | steven.daprano | set | recipients:
+ steven.daprano, barry, docs@python, Alexander Todorov |
2017-03-08 15:01:57 | steven.daprano | set | messageid: <1488985317.79.0.112661931752.issue29756@psf.upfronthosting.co.za> |
2017-03-08 15:01:57 | steven.daprano | link | issue29756 messages |
2017-03-08 15:01:57 | steven.daprano | create | |
|