New submission from nickeubank: Found an odd behavior I'd never known about today, not sure if it's a bug or known. Python 3.4.4 (anaconda)
True, False, 0, 1 can all be used as dictionary keys. But Apparently True and 1 hash to the same item and False and 0 hash to the same item, so they can easily overwrite (which I spent a while banging my head over today). In other words: In[1]: d = {True: 'a', False: 'b'} d[0] = 'z' d[False] Out[1]: 'z' ---------- messages: 262232 nosy: nickeubank priority: normal severity: normal status: open title: False/0 and True/1 collision when used as dict keys? versions: Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26614> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com