Re: Observer implementations

2009-06-17 Thread Mike C. Fletcher
Tobias Weber wrote: > In article , > "Mike C. Fletcher" 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 "cannot create weak reference > to 'classmethod' object". Out

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 ha

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 cl

Re: Observer implementations

2009-06-15 Thread Carl Banks
On Jun 15, 5:22 pm, Tobias Weber wrote: > In article , >  Gerhard Häring 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 reimplementing the wheel might actually be less work than adapting a thir

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/ a