On Dec 24, 11:48 pm, "Gabriel Genellina" <gagsl-...@yahoo.com.ar>
wrote:
> En Wed, 24 Dec 2008 16:18:55 -0200, Kottiyath <n.kottiy...@gmail.com>  
> escribió:
>
> >> The other thing to remember is that because the 'registry' contains
> >> references to the instances, they won't be garbage collected.
>
> > Is there any other way out in this case?
> > I have factory methods - and I have to loop over them - sort of Chain
> > of Responsibility pattern.
> > Having a registry inside the class instance and looping through them
> > was the only clean thing I could think of.
> > I understand that garbage collection would be an issue - but is there
> > any way out?
>
> You may keep all that structures - just use weak references (see the  
> weakref module).
> There isn't a WeakList nor WeakSet out-of-the-box but you may use a  
> WeakKeyDictionary (set the value to anything, None by example).
>
> --
> Gabriel Genellina

Thank you very much, Gabriel.
I am very thankful to everyone.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to