tuple weakref

Alex Martelli aleax at aleax.it
Sun Apr 13 21:58:55 CEST 2003


<posted & mailed>

Robin Becker wrote:
   ...
> resolve and break any loop. As you say tuples (and the None object)
> aren't weakrefable (for some reason).

Micro-optimization...?

> The trivial silly solution is to attempt to hide the tupleness inside
> another class, but that won't work as the wrapper dies immediately.
> 
> The tuples are coming from pyRXP's tuple tree representation.

The simplest solution is to have pyRXP return a tree of *LISTS*,
instead of a tree of *TUPLES*, as it's able to do since about 6
months ago thanks to the tiny changes you and I made to it.  As
I showed back then, there's no measurable cost connected to that,
and the advantages are many.


Alex





More information about the Python-list mailing list