tuple weakref

Martin v. Löwis martin at v.loewis.de
Sun Apr 13 16:45:01 EDT 2003


Alex Martelli <aleax at aleax.it> writes:

> > resolve and break any loop. As you say tuples (and the None object)
> > aren't weakrefable (for some reason).
> 
> Micro-optimization...?

Backwards compatibility. To make tuples support weak references, one
has to define where the weakref slot goes into the tuple object. It
can't go at the end (which would be backwards compatible), as a tuple
is variably-sized, and it can't go in the beginning, as that
"dramatically" breaks ABI compatibility.

Performance is certainly another concern.

Regards,
Martin




More information about the Python-list mailing list