Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weakref should have a WeakSet #40514

Closed
leorochael mannequin opened this issue Jul 6, 2004 · 3 comments
Closed

weakref should have a WeakSet #40514

leorochael mannequin opened this issue Jul 6, 2004 · 3 comments
Labels
stdlib Python modules in the Lib dir

Comments

@leorochael
Copy link
Mannequin

leorochael mannequin commented Jul 6, 2004

BPO 985753
Nosy @rhettinger

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2004-07-10.23:58:04.000>
created_at = <Date 2004-07-06.06:42:00.000>
labels = ['library']
title = 'weakref should have a WeakSet'
updated_at = <Date 2004-07-10.23:58:04.000>
user = 'https://bugs.python.org/leorochael'

bugs.python.org fields:

activity = <Date 2004-07-10.23:58:04.000>
actor = 'rhettinger'
assignee = 'none'
closed = True
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2004-07-06.06:42:00.000>
creator = 'leorochael'
dependencies = []
files = []
hgrepos = []
issue_num = 985753
keywords = []
message_count = 3.0
messages = ['21424', '21425', '21426']
nosy_count = 2.0
nosy_names = ['rhettinger', 'leorochael']
pr_nums = []
priority = 'normal'
resolution = 'wont fix'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue985753'
versions = []

@leorochael
Copy link
Mannequin Author

leorochael mannequin commented Jul 6, 2004

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.

@leorochael leorochael mannequin closed this as completed Jul 6, 2004
@leorochael leorochael mannequin added the stdlib Python modules in the Lib dir label Jul 6, 2004
@leorochael leorochael mannequin closed this as completed Jul 6, 2004
@leorochael leorochael mannequin added the stdlib Python modules in the Lib dir label Jul 6, 2004
@rhettinger
Copy link
Contributor

Logged In: YES
user_id=80475

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

@rhettinger
Copy link
Contributor

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

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir
Projects
None yet
Development

No branches or pull requests

1 participant