The joys of weakrefs... references to instance methods (callbacks)
Magnus Lie Hetland
mlh at vier.idi.ntnu.no
Tue Feb 12 12:20:04 EST 2002
In article <mailman.1013502171.782.python-list at python.org>, Mike C.
Fletcher wrote:
>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.
Take a look at References.py and Events.py together -- Events.py is
the dispatcher part; References.py is just a set of utilities for
references that can be either weak or strong.
> Was one of
>these modules based on the other (your comments on the ASPN site seem to
>suggest there's some relationship)?
Yes, the dispatcher in Anygui is based on this and at least two other
similar dispatcher modules (but it is basically a full rewrite). There
was some lengthy discussion on the Anygui devel list about this sort
of dispatcher mechanism a while ago. (If you're interested, I could
probably find the other two modules as well :)
One advantage of the Anygui dispatcher is that it allows you to use
weak references for some handlers and strong references for others.
(Maybe Patrick has also added that now -- I'm not sure.)
>Good job all around. Thanks,
>Mike
--
Magnus Lie Hetland The Anygui Project
http://hetland.org http://anygui.org
More information about the Python-list
mailing list