Why doesn't this work?

>>> from weakref import ref
>>> class C(str): pass
... 
>>> ref(C())
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: cannot create weak reference to 'C' object
>>> 

Note that this does work:

>>> class D(int): pass
... 
>>> ref(D())
<weakref at 0x53e10; dead>
>>> 

Likewise for floats, lists, etc.  Everything but strs.

rg
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to