Weakrefs to classes that derive from str

Peter Hansen peter at engcorp.com
Wed Mar 30 12:02:17 EST 2005


Ron Garret wrote:
>>>>foo(int)
>>>>foo(float)
>>>>foo(dict)
>>>>foo(list)
>>>>foo(str)
> TypeError: cannot create weak reference to 'C' object
> 
>>>>foo(tuple) 
> TypeError: cannot create weak reference to 'C' object
> 
>>>>foo(long)
> TypeError: cannot create weak reference to 'C' object
> 
> Ah, it appears that non-immediate immutable types don't support 
> weakrefs.  Hm...

I see the same results you do, and yet I don't understand
the comment.  Can you please explain what "immediate"
means in this context?

-Peter



More information about the Python-list mailing list