[Python-Dev] New methods for weakref.Weak*Dictionary types
Fred L. Drake, Jr.
fdrake at acm.org
Mon May 1 22:14:28 CEST 2006
I'd like to commit this for Python 2.5:
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 L. Drake, Jr. <fdrake at acm.org>
More information about the Python-Dev