Weakrefs to classes that derive from str

Steven Bethard steven.bethard at gmail.com
Wed Mar 30 18:20:22 CEST 2005

Peter Hansen wrote:
> I believe it's here: http://docs.python.org/lib/module-weakref.html
> if you search for the string "Not all" and read the next two
> paragraphs.
> On the other hand, it says (there) only that "several builtin
> types such as list and dict ... can add support through
> subclassing", and does not say anything about int, str, etc...

Ahh, thanks for the help.  I guess there are at least two solutions to 
the OP's problem then:

(1) Document that str and subclasses of str can't be weakreffed (easy)
(2) Change str so that it (or at least its subclasses) can be weakreffed 

Probably either way a feature request should be filed.


More information about the Python-list mailing list