Observer implementations

Carl Banks pavlovevidence at
Mon Jun 15 21:49:16 EDT 2009

On Jun 15, 5:22 pm, Tobias Weber <t... at> wrote:
> In article <mailman.1584.1245073461.8015.python-l... at>,
>  Gerhard Häring <g... at> 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 third-party implementation.  But I'll leave that decision
to you.

> I'd still need to know how to weakref a classmethod

I can't imagine why you would need to weak reference a class method,
since they usually live forever along with the class.  But again, you
are doing it so you would know.  I can't think of an easy way to do it
without metaclass programming.

Unless you are trying to create a weakref to a bound classmethod.  I'd
say that's still pretty useless: bound classmethods only keep alive
classes and classmethods, which both live forever, and bound
classmethods are lightweight and hardly worth the effort.

Maybe show us what you need to weak reference classmethods for and we
can help you better.

Carl Banks

More information about the Python-list mailing list