[Python-Dev] Why aren't more things weak referencable

"Martin v. Löwis" martin at v.loewis.de
Mon May 31 03:49:14 EDT 2004

Raymond Hettinger wrote:
> For strings at least, perhaps it is time to bite the bullet and include
> weak reference support directly.  Weak reference support ups the per
> string memory overhead from five words (ob_type, ob_refcnt, ob_size,
> ob_shash, ob_sstate) to six.  The whole concept of weak  dictionaries is
> much more useful when strings can be used as keys and/or values.

Can you elaborate that? What specific, real-life application do you
have in mind that requires strings to be weakly-referencable?

Because strings are immutable, you often get unexpected references to
them, so people have learned not to care about the life cycle of string


More information about the Python-Dev mailing list