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
Note in documentation for weakrefs #59617
Comments
In the documentation on weakrefs there is the following quote
But I think the weakref is always dead by the time the callback is invoked. The first paragraph from the documentation for weakref.ref(object[, callback]) contains the following:
Which does prompt a question: what use is there for the weakref argument to the callback if it already dead? (Compare http://bugs.python.org/issue14933) |
It's true, the doc needs fixing.
The weakref is "dead" but it's still a weakref, and it can be used to |
Ah. I had assumed that since dead weakrefs were unhashable you couldn't safely use them as keys in a dict. (Presumably removal of a no longer hashable key from a dict is O(n)?) I also hadn't realize that weakrefs were subclassable. |
They are unhashable if you didn't hash them alive. Otherwise they retain |
New changeset 78b0f294674c by Richard Oudkerk in branch '2.7': New changeset 24b13be81d61 by Richard Oudkerk in branch '3.2': |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: