Observer Pattern (if you got some spare time)
Fredrik Lundh
fredrik at pythonware.com
Thu Jun 26 04:13:48 EDT 2003
Patrick Useldinger wrote:
> following a previous thread on Patterns, I ended up reading the famous
> book by Gamma et al., and implemented a "kind of" observer pattern.
> If anyone has some spare time and some interest, take a look at:
>
> http://www.homepages.lu/pu/python.pubsub.py.html
oh. that's a lot of code. I'm beginning to suspect that the
approach I'm using is way too simple...
http://effbot.org/zone/simple-observer.htm
Donnal Walter wrote:
> The Observer Pattern can be used for implementing Model-View-Presenter
> architectures. In this case, however, it would be more convenient to use
> weak references to observers so that when a GUI component is dismissed,
> it is *automatically* removed from the observer list.
is that really much of a problem? it's not like the GUI component
won't know what model it's watching, or when the component it-
self is dismissed, right?
(just add a removeobserver(self) call to ui_handle_destroy, and
you're done...)
</F>
More information about the Python-list
mailing list