"Keith" <[EMAIL PROTECTED]> wrote: > > > Any help would be great. > > > > Cheers, > > Keith > >
Do you absolutely need the functionality to be in the __init__ method, or does something like the following work: >>> IDs={} >>> class ID: pass >>> def factory(ident): if ident in IDs: instance=IDs[ident] else: instance=ID() IDs[ident]=instance return instance >>> g=factory(1) >>> h=factory(2) >>> i=factory(1) >>> g,h,i (<__main__.ID instance at 0x00A45FD0>, <__main__.ID instance at 0x00A4B918>, <__main__.ID instance at 0x00A45FD0>) >>> max -- http://mail.python.org/mailman/listinfo/python-list