The joys of weakrefs... references to instance methods (callbacks)
Mike C. Fletcher
mcfletch at geocities.com
Tue Feb 12 03:21:07 EST 2002
Very nice module. I just did a re-write of my watcher classes using
dispatcher. Why did I keep the watcher pattern? Well, it makes
creating pre-event processing possible (my one class needs to do some
processing to determine conflicts, and until 2.2 object-based-classes
(with properties) can live in ZODB, I'm stuck with that).
Would be nice if there was a simple download somewhere (had to re-format
the code after Mozilla mangled it with cut-and-paste). Should put an
explicit license in there (as ActiveState's legal policy says that the
license included with the contribution applies.
Also looked at the References.py module in anygui. Didn't spend much
time on it, as dispatcher is much closer to what I need. Was one of
these modules based on the other (your comments on the ASPN site seem to
suggest there's some relationship)?
Good job all around. Thanks,
Patrick K. O'Brien wrote:
> You might find this useful:
> This module, dispatcher.py, provides global signal dispatching services
> suitable for a wide variety of purposes, similar to Model-View-Controller or
> Model-View-Presenter patterns. This particular implementation allows a
> looser coupling than most Observer patterns. It also does transparent
> cleanup through the use of weak references and weak reference callbacks.
> This version defaults to using weak references, but provides an option to
> not use weak references for those cases where weak references are
> problematic (lambdas and such).
> Patrick K. O'Brien
More information about the Python-list