[Python-Dev] doc change for weakref

Antoine Pitrou solipsis at pitrou.net
Fri May 25 19:46:27 CEST 2012


On Fri, 25 May 2012 10:21:39 -0700
Ethan Furman <ethan at stoneleaf.us> wrote:
> I'd like to make a slight doc change for weakref to state (more or less):
> 
>     weakrefs are not invalidated when the strong refs
>     are gone, but rather when garbage collection
>     reclaims the object
> 
> Should this be accurate for all implementations, or should it be more 
> along the lines of:
> 
>     weakrefs may be invalidated as soon as the strong refs
>     are gone, but may last until garbage collection reclaims
>     the object

How about: weakrefs are invalidated when the object is destroyed,
either as a product of all the strong references being gone or the
object being reclaimed by the :term:`cyclic garbage collector
<garbage collection>`.

Regards

Antoine.




More information about the Python-Dev mailing list