A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-November/049792.html below:

[Python-Dev] Re: weakref gc semantics

[Python-Dev] Re: weakref gc semantics [Python-Dev] Re: weakref gc semanticsJim Fulton jim at zope.com
Fri Nov 5 15:25:20 CET 2004
Greg Ewing wrote:
> Neil Schemenauer wrote:
> 
>> I think there may be one small problem though.  Callbacks get passed
>> the weakref object.  Doesn't that break the rule that trash should
>> not be exposed to Python code while the collection is taking place?
> 
> 
> Maybe the callback shouldn't be passed the weakref object?
> I don't see what good that does anyway, since the weakref
> is just an empty shell by then, isn't it?

No.  It can still be used as a key. It still has it's original
hash value and will compare equal to other weakrefs to the same
original object. Weak-key dictionaries depend on this. In addition,
as Tim points out, it could be a weakref-subclass instance and
could have additional useful data.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4