Python interpreter bug

alainpoint at yahoo.fr alainpoint at yahoo.fr
Fri Oct 7 21:07:56 CEST 2005


> Steve Holden wrote:
>Consider:

 >>> a = {1:'one'}
 >>> b = {2:'two'}
 >>> c = {1:'one'}
 >>> a is c
False
 >>> a in [b, c]
True
 >>>


>What would you have Python do differently in these circumstances?

You mean: What i would do i if i was the benevolent dictator ?
I would make a distinction between mutables and immutables. Immutables
would test for equality and mutables would test for identity.
Membership testing for objects is a very common use case which is
totally unrelated to their being sorted according to a key.
I am no expert on languages so i could be wrong. Don't hesitate to
correct me.
Alain




More information about the Python-list mailing list