[issue14898] Dict collision on boolean and integer values

2012-05-24 Thread Sasha B
Sasha B added the comment: Ahh, I see. You are correct. Thanks. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscri

[issue14898] Dict collision on boolean and integer values

2012-05-24 Thread Mark Dickinson
Mark Dickinson added the comment: Thanks for the report. Yes, this is expected. Dictionary membership is based on equality of keys. Since True and 1 are equal, only one of them can be present in a dictionary at a time (and a key lookup works with either). >>> x = {0: 'bar'} >>> x[0] 'bar'

[issue14898] Dict collision on boolean and integer values

2012-05-24 Thread Sasha B
Changes by Sasha B : -- components: +Build type: -> behavior versions: +Python 2.7 ___ Python tracker ___ ___ Python-bugs-list mailin

[issue14898] Dict collision on boolean and integer values

2012-05-24 Thread Sasha B
New submission from Sasha B : Not sure if this is predicted behaviour, but if I make a dict like: >>> x = {0: 'bar', True: 'foo'} and modify True with 1, or 0 with False: >>> x[False] = 'boo' >>> x[1] = 'far' the modifications happen: >>> x {0: 'boo', True: 'far'} Is this expected behaviour?