Message223284
>>> l = [False, True]
>>> l.index(True)
1
>>> l.index(False)
0
good, but:
>>> l = ['a', '', {}, 2.7, 1, 0, False, True]
>>> l.index(True)
4
>>> l.index(False)
5
Apparently, True and False get converted to int in comparisons to ints.
I would expect items to be compared either by:
a) object identity or
b) __eq__
but not this inconsistently.
Best,
Wolfgang |
|
Date |
User |
Action |
Args |
2014-07-16 21:43:37 | wolma | set | recipients:
+ wolma |
2014-07-16 21:43:37 | wolma | set | messageid: <1405547017.25.0.264801773086.issue21993@psf.upfronthosting.co.za> |
2014-07-16 21:43:37 | wolma | link | issue21993 messages |
2014-07-16 21:43:37 | wolma | create | |
|