weakref.proxy behaviour in python 3.0

Nicholas Cole nicholas.cole at gmail.com
Sat Aug 21 14:13:14 CEST 2010


Dear List,

I've searched for information on this without success.  Has
weakref.proxy changed in Python 3?  I couldn't see any note in the
documentation, but the following code behaves differently on Python
2.6.1 and Python 3:

import weakref
class Test(object): pass

realobject = Test()
pobject = weakref.proxy(realobject)
l = [pobject,]

print(realobject in l)   # On python 2.6 this prints False, on Python 3 True.

Is this an expected change?

Best wishes,

Nicholas



More information about the Python-list mailing list