Remove the .clear() method; add a link to the patch on SF.

This commit is contained in:
Fred Drake 2001-01-22 20:24:56 +00:00
parent 662846454a
commit bd39cf0ae3
1 changed files with 10 additions and 9 deletions

View File

@ -5,7 +5,7 @@ Author: Fred L. Drake, Jr. <fdrake@acm.org>
Python-Version: 2.1 Python-Version: 2.1
Status: Incomplete Status: Incomplete
Type: Standards Track Type: Standards Track
Post-History: Post-History: 11 January 2001
Motivation Motivation
@ -81,14 +81,11 @@ Proposed Solution
weakref.mapping() will create a "weak dictionary". weakref.mapping() will create a "weak dictionary".
A weak reference object will allow access to the referenced object A weak reference object will allow access to the referenced object
if it hasn't been collected, allows application code to either if it hasn't been collected and to determine if the object still
"clear" the weak reference and the associated callback, and to exists in memory. These operations are accessed via the .get()
determine if the object still exists in memory. These operations and .islive() methods. If the object has been collected, .get()
are accessed via the .get(), .clear(), and .islive() methods. If will return None and islive() will return false. Weak references
the object has been collected, .get() will return None and are not hashable.
islive() will return false; calling .clear() will produce the same
result, and is allowed to occur repeatedly. Weak references are
not hashable.
A weak dictionary maps arbitrary keys to values, but does not own A weak dictionary maps arbitrary keys to values, but does not own
a reference to the values. When the values are finalized, the a reference to the values. When the values are finalized, the
@ -142,6 +139,10 @@ Implementation Strategy
dictionaries. Whether it should include strings, buffers, lists, dictionaries. Whether it should include strings, buffers, lists,
files, or sockets is debatable. files, or sockets is debatable.
There is a preliminary patch on SourceForge:
http://sourceforge.net/patch/?func=detailpatch&patch_id=103203&group_id=5470
Possible Applications Possible Applications