>>> help(weakref.ref) Help on built-in function ref: ref(...) new(object[, callback]) -- create a weak reference to 'object'; when 'object' is finalized, 'callback' will be called and passed a reference to 'object'. ^^^^^^^^^^^^^^^^^^^^^^^ This appears to be a lie, or at least misleadingly phrased, in Python 2.2.1: >>> class Z: pass ... >>> def dying(x): print x, 'is dying' ... >>> z = Z() >>> r = weakref.ref(z, dying) >>> z = 1 <weakref at 9826f8; dead> is dying It appears that it's a reference to the weakref object that's passed, not the dying object itself. What's the intention? TIA, Dave +---------------------------------------------------------------+ David Abrahams C++ Booster (http://www.boost.org) O__ == Pythonista (http://www.python.org) c/ /'_ == resume: http://users.rcn.com/abrahams/resume.html (*) \(*) == email: david.abrahams@rcn.com +---------------------------------------------------------------+
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