Neil Schemenauer wrote: > On Thu, Nov 04, 2004 at 12:25:32AM -0500, Tim Peters wrote: > >>One I sketched last time, and is in the attached patch-callback.txt. >>(Patches here just have gcmodule.c code changes, no corresponding >>changes to comments.) The difference is that it invokes a callback on >>a weakref to trash iff the callback is reachable, instead of invoking >>a callback on a weakref to trash iff the weakref it's attached to is >>reachable. > > > I like this idea best. I don't see why it should be hard to > explain. Instead of saying: > > If you want the weakref callback to be invoked, ensure the > WEAKREF outlives the referent. > > we say: > > If you want the weakref callback to be invoked, ensure the > CALLBACK outlives the referent. > > 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? Exactly, that's why I prefer the other approach. 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
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