ANNOUNCE: WeakList

Andres Tuells atuells at integralab.com
Fri Nov 30 18:34:03 CET 2001


What is:
Python implementation of weaklist: list whose entries are 
weak references, and are removed when the original object is
garbage collected. They are useful for example when you want a 
publisher/subscriber list. Subscriber are authomatically removed 
from the publisher list when they are gc (and can be gc).

You can do:
for subscriber in weaklist_subscribers:
    self.notify(subscriber, message)

If a subscriber is gc while the for is running, then it will be 
removed also be removed from the weak_list. WeakList has 
an iterator that constains a weaklist.

I think that WeakList place is inside weakref.py, but I don't now how to contribute to python code.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20011130/d6e84843/attachment.html>


More information about the Python-list mailing list