[Raymond Hettinger] > > I would like to know what you all think about formalizing an observer > protocol for python objects. Interesting question. I'm curious to see the responses this will get. For discussion sake I'll throw in my dispatcher recipe as an example of a very loosely coupled alternative to the traditional Observer pattern: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/87056 I'm not suggesting that it does exactly what you want. I just want to round out the discussion. Zope3 is doing something similar with its EventHub, I believe. There is something about the Observer pattern that I've never fully liked. It seems to introduce a level of coupling that, to my way of thinking, "corrupts" the design of the object being observed. In real life, things can be observed without their knowledge. So why should an observable object have to keep track of all of its listeners and notify them regularly? That doesn't seem like the right distribution of responsibility to me. And that line of thinking lead me to create dispatcher. But I'm willing to hear about the benefits of your idea. A standardized implementation might overcome my initial reluctance. So what are the benefits of formalizing this? --- Patrick K. O'Brien Orbtech
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