[issue21993] counterintuitive behavior of list.index with boolean values

Ezio Melotti report at bugs.python.org
Wed Jul 16 23:51:55 CEST 2014


Ezio Melotti added the comment:

It's using __eq__:
>>> l = [3, 1.0, 5, True, 7, 1]
>>> l.index(1)
1
>>> l.index(True)
1
>>> l.index(1.0)
1
>>> True == 1 == 1.0
True

----------
nosy: +ezio.melotti
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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


More information about the Python-bugs-list mailing list