[Python-checkins] CVS: python/nondist/peps pep-0205.txt,1.9,1.10
Fred L. Drake
fdrake@users.sourceforge.net
Mon, 22 Jan 2001 14:11:05 -0800
Update of /cvsroot/python/python/nondist/peps
In directory usw-pr-cvs1:/tmp/cvs-serv20323
Modified Files:
pep-0205.txt
Log Message:
Some minor updates to reflect the removal of .clear(). Added information
(preliminary) about proxy objects.
Index: pep-0205.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0205.txt,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** pep-0205.txt 2001/01/22 20:24:56 1.9
--- pep-0205.txt 2001/01/22 22:11:03 1.10
***************
*** 75,83 ****
files, etc.).
! A new module, weakref, will contain two new functions used to
! create weak references. weakref.new() will create a "weak
! reference object" and optionally attach a callback which will be
! called when the object is about to be finalized.
! weakref.mapping() will create a "weak dictionary".
A weak reference object will allow access to the referenced object
--- 75,85 ----
files, etc.).
! A new module, weakref, will contain new functions used to create
! weak references. weakref.new() will create a "weak reference
! object" and optionally attach a callback which will be called when
! the object is about to be finalized. weakref.mapping() will
! create a "weak dictionary". A third function, weakref.proxy(),
! will create a proxy object that behaves somewhat like the original
! object.
A weak reference object will allow access to the referenced object
***************
*** 100,110 ****
dictionaries, weak dictionaries are not hashable.
! The callbacks registered with weak reference objects or in weak
! dictionaries must accept a single parameter, which will be the
! weak-ly referenced object itself. The object can be resurrected
! by creating some other reference to the object in the callback, in
! which case the weak reference generating the callback will still
! be cleared but no weak references remaining to the object will be
! cleared.
--- 102,124 ----
dictionaries, weak dictionaries are not hashable.
! Proxy objects are weak references that attempt to behave like the
! object they proxy, as much as they can. Regardless of the
! underlying type, proxies are not hashable since their ability to
! act as a weak reference relies on a fundamental mutability that
! will cause failures when used as dictionary keys -- even if the
! proper hash value is computed before the referent dies, the
! resulting proxy cannot be used as a dictionary key since it cannot
! be compared once the referent has expired, and comparability is
! necessary for dictionary keys. Operations on proxy objects after
! the referent dies cause weakref.ReferenceError to be raised in
! most cases. "is" comparisons, type(), and id() will continue to
! work, but always refer to the proxy and not the referent.
!
! The callbacks registered with weak references must accept a single
! parameter, which will be the weak-ly referenced object itself.
! The object can be resurrected by creating some other reference to
! the object in the callback, in which case the weak reference
! generating the callback will still be cleared but no remaining
! weak references to the object will be cleared.