New submission from Alexander Todorov:

When using list.count() I get the following results

    >>> [1, 2, 3].count(1)
    1
    >>> [1, 2, 3, True].count(2)
    1
    >>> [1, 2, 3, True].count(True)
    2
    >>> [1, 2, 3, True].count(1)
    2

as you can see True is considered the same as 1.  The documentation for the 
count method says:

    count(...)
        L.count(value) -> integer -- return number of occurrences of value

so IMO the above behavior is wrong. Seeing this on a RHEL 7 system with 
Python 3.5.1 and 2.7.5

----------
messages: 289235
nosy: Alexander Todorov
priority: normal
severity: normal
status: open
title: List count() counts True as 1
versions: Python 2.7, Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29756>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to