This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: weakref dict methods
Type: Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: fdrake Nosy List: fdrake, tim.peters
Priority: normal Keywords: patch

Created on 2006-05-01 20:08 by fdrake, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
weakreflists.patch fdrake, 2006-05-01 20:08 Patch
weakreflists.patch fdrake, 2006-05-01 21:20 Version 2, simplified implementation, improved docs
Messages (4)
msg50169 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2006-05-01 20:08
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.
msg50170 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2006-05-01 21:20
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.
msg50171 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2006-05-02 06:13
Logged In: YES 
user_id=31435

Looks good to me, Fred, and thanks!  Marked Accepted and
back to you.
msg50172 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2006-05-02 06:55
Logged In: YES 
user_id=3066

Committed in revision 45853.
History
Date User Action Args
2022-04-11 14:56:17adminsetgithub: 43308
2006-05-01 20:08:13fdrakecreate