Hi,
I'm not sure why this doesn't work:
>>>dic_myinstances={}
>>>class MyClass(object):
def __init__(self, id):
global dic_myinstances
if dic_myinstances.has_key(id):
self = dic_myinstances[id]
else:
dic_myinstances[id] = self
>>>ins1 = MyClass('xx')
>>>ins2 = MyClass('yy')
>>>ins3 = MyClass('xx')
>>>ins3 is ins1
False
Why isn't ins3 the same as ins1? How can I get this to work?
thanks
--
http://mail.python.org/mailman/listinfo/python-list
