Strange behavior of weak references (weakref module)

Greg Ewing greg at cosc.canterbury.ac.nz
Wed Dec 19 17:44:38 EST 2001


Tiberius Teng wrote:
> 
> I found this behavior (bug?) when I want to create weak reference to a
> instance method.

Every time the expression A.test is evaluated, a *new*
bound method object is created. If you don't store a
strong reference to this object somewhere, it will
immediately disappear.

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list