I'd like to commit this for Python 2.5:

http://www.python.org/sf/1479988

The WeakKeyDictionary and WeakValueDictionary don't
provide any API to get just the weakrefs out, instead
of the usual mapping API. This can be desirable when
you want to get a list of everything without creating
new references to the underlying objects at that moment.

This patch adds methods to make the references
themselves accessible using the API, avoiding requiring
client code to have to depend on the implementation.
The WeakKeyDictionary gains the .iterkeyrefs() and
.keyrefs() methods, and the WeakValueDictionary gains
the .itervaluerefs() and .valuerefs() methods.

The patch includes tests and docs.


  -Fred

-- 
Fred L. Drake, Jr.   <fdrake at acm.org>
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to