At 09:29 AM 2/17/2008 +0000, Nick Craig-Wood wrote: >On Fri, Feb 15, 2008 at 01:20:03PM -0800, Guido van Rossum wrote: > > But maybe given how rare the use case is, it would be easier to just > > create a custom class in weakref.py that does what Nick requested. > >I still don't like the silent failure, but a noisy failure and a >custom class would be great. > >FYI here is the class I was writing which tripped me up. I created >this to untangle some spaghetti code in a reasonably complex GUI >application I'm writing. > >Instead of there being lots of hardcoded callbacks in the GUI objects >I made a central registry which made the code a lot cleaner. The >weakrefs avoided registration and deregistration.
You might want to check this out: http://pypi.python.org/pypi/PyDispatcher """Included in the package are the robustapply and saferef modules, which provide the ability to selectively apply arguments to callable objects and to reference instance methods using weak-references.""" _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com