[Patches] [ python-Patches-1479988 ] weakref dict methods

SourceForge.net noreply at sourceforge.net
Tue May 2 08:13:42 CEST 2006


Patches item #1479988, was opened at 2006-05-01 16:08
Message generated for change (Comment added) made by tim_one
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1479988&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.5
Status: Open
>Resolution: Accepted
Priority: 5
Submitted By: Fred L. Drake, Jr. (fdrake)
>Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: weakref dict methods

Initial Comment:
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.


----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2006-05-02 02:13

Message:
Logged In: YES 
user_id=31435

Looks good to me, Fred, and thanks!  Marked Accepted and
back to you.

----------------------------------------------------------------------

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2006-05-01 17:20

Message:
Logged In: YES 
user_id=3066

Tim noted in email:

http://mail.python.org/pipermail/python-dev/2006-May/064751.html

that the implementation could and probably should be
simplified.  This second version of the patch does that, and
updates the documentation to note the liveness issues of the
references, as well as avoid repetition.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1479988&group_id=5470


More information about the Patches mailing list