[ python-Bugs-985753 ] weakref should have a WeakSet

SourceForge.net noreply at sourceforge.net
Sun Jul 11 01:58:05 CEST 2004


Bugs item #985753, was opened at 2004-07-06 01:42
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=985753&group_id=5470

Category: Python Library
Group: None
>Status: Closed
>Resolution: Wont Fix
Priority: 5
Submitted By: Leonardo Rochael Almeida (rochael)
Assigned to: Nobody/Anonymous (nobody)
Summary: weakref should have a WeakSet

Initial Comment:
It'd be nice if weakref had a WeakSet. This way I
wouldn't need a WeakValueDictionary keyed by id(object)
when all I want is to iterate over the objects that are
still alive.

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

>Comment By: Raymond Hettinger (rhettinger)
Date: 2004-07-10 18:58

Message:
Logged In: YES 
user_id=80475

Closing this as won't fix.

The WeakKeyDictionary and fromkeys() method meet this need
easily:

alive = WeakKeyDictionary.fromkeys(*objlist)
  . . .
print list(alive)    # always current list of alive objects


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

Comment By: Raymond Hettinger (rhettinger)
Date: 2004-07-06 09:09

Message:
Logged In: YES 
user_id=80475

Why not use a WeakKeyDictionary with the values set to True?

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

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


More information about the Python-bugs-list mailing list