Re: Observer implementations

2009-06-17 Thread Mike C. Fletcher
Tobias Weber wrote: In article mailman.1631.1245160392.8015.python-l...@python.org, Mike C. Fletcher mcfle...@vrplumber.com wrote: See PyDispatcher for code to do this. That was the original problem. Got it now: if used inside the class definition dispatcher.connect will raise

Re: Observer implementations

2009-06-16 Thread Mike C. Fletcher
Tobias Weber wrote: ... No time to reinvent the wheel I'd still need to know how to weakref a classmethod See PyDispatcher for code to do this. PyDispatcher, at least, is not abandoned, it would be more accurate to say finished. I use it in OpenGLContext (extensively), but I haven't had

Re: Observer implementations

2009-06-15 Thread Gerhard Häring
Tobias Weber wrote: Hi, how to use the Observer pattern in Python? Implement it in your classes? I found PubSub and PyDispatcher, both of which are abandoned. [...] I haven't searched for these, but googling for python observer pattern yields http://code.activestate.com/recipes/131499/ and

Re: Observer implementations

2009-06-15 Thread Carl Banks
On Jun 15, 5:22 pm, Tobias Weber t...@gmx.net wrote: In article mailman.1584.1245073461.8015.python-l...@python.org,  Gerhard Häring g...@ghaering.de wrote: Implement it in your classes? No time to reinvent the wheel Hmm, observer pattern seems to be one of those things simple enough that

Re: Observer implementations

2009-06-15 Thread I V
On Mon, 15 Jun 2009 15:29:34 +0200, Tobias Weber wrote: Despite the confusion all those are useable, but I ran into the problem that I can't register a @classmethod because weakref doesn't like them. What do you mean by weakref not liking class methods? This seems to work OK on python 2.6