Alex Martelli wrote:
> Michael Schneider <[EMAIL PROTECTED]> wrote:
> 
> 
>>I would like to use weak refs in an observer pattern implementation.
>>The problme that I have seems to be that weakrefs can't manage functions.
> 
> 
> They can manage just fine functions written in *Python*, just not
> "builtin functions*, i.e., ones written in *C*.  Just wrap any builtin
> function you need to register as observer into a tiny Python-coded
> wrapper and live happily ever after.
>    ...
> 
>>Not all objects can be weakly referenced; those objects which can 
>>include class instances, functions written in Python (but not in C), 
> 
> 
> 
> Alex
Alex,

Thank you, I mis-read the docs.

The mistake I  made was having was using a weak reference as a key in 
the dictionary.

Weak references will be very useful for me.

I really enjoy python.  So many good things have been added to the 
language without taking the fun away :-)

Mike

-- 
The greatest performance improvement occurs on the transition of from 
the non-working state to the working state.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to