8000 gh-91081: Add note on WeakKeyDictionary behavior when deleting a replaced entry by slateny · Pull Request #91499 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-91081: Add note on WeakKeyDictionary behavior when deleting a replaced entry #91499

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

Merged
merged 9 commits into from
Dec 21, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add extra sentence to correct misunderstanding of issue
  • Loading branch information
slateny committed Apr 13, 2022
commit 5961498675afc0f9b3c686e49d1d9855a9a9f886
3 changes: 2 additions & 1 deletion Doc/library/weakref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ See :ref:`__slots__ documentation <slots>` for details.

Note that when a key with equal value to an existing key (but not equal identity)
is inserted into the dictionary, it replaces the value but does not replace the
existing key::
existing key. Due to this, when the reference to the original key is deleted, it
also deletes entry in the dictionary::

d = WeakKeyDictionary()
d[k1] = 1 # d = {k1: 1}
Expand Down
0