weakrefs and bound methods

Mathias Panzenboeck e0427417 at student.tuwien.ac.at
Sun Oct 7 18:17:25 EDT 2007


Alex Martelli wrote:
> Mathias Panzenboeck <e0427417 at student.tuwien.ac.at> wrote:
> 
>> Marc 'BlackJack' Rintsch wrote:
>>> ``del b`` just deletes the name `b`.  It does not delete the object.
>>> There's still the name `_` bound to it in the interactive interpreter.
>>> `_` stays bound to the last non-`None` result in the interpreter.
>> Actually I have the opposite problem. The reference (to the bound method)
>> gets lost but it shouldn't!
> 
> weakrefs to bound methods require some subtlety, see
> <http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81253> (or what
> I believe is the better treatment of this recipe in the printed edition
> of the Python Cookbook -- of course, being the latter's editor, I'm
> biased;-).
> 
> 
> Alex

Thank you, that really helped. :)


	-panzi



More information about the Python-list mailing list