Hi, I solved it myself! I realised that __new__ creates self prior to init, so this works:
>>>dic_myinstances={} >>>class MyClass(object): def __new__(self,id): global dic_myinstances if dic_myinstances.has_key(id): return dic_myinstances[id] else: dic_myinstances[id] = self return self >>>ins1 = MyClass('xx') >>>ins2 = MyClass('yy') >>>ins3 = MyClass('xx') >>>print ins3 is ins1 True Is this the best way to do this? -- http://mail.python.org/mailman/listinfo/python-list