New submission from Wolfgang Maier: >>> 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 ---------- components: Interpreter Core messages: 223284 nosy: wolma priority: normal severity: normal status: open title: counterintuitive behavior of list.index with boolean values type: behavior versions: Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21993> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com