[Python-Dev] Why aren't more things weak referencable (original) (raw)

Guido van Rossum guido at python.org
Mon May 31 23:15:08 EDT 2004


Same here. I wouldnot vote to make strings or tuples or any other tiny type weak-reffed in the first place. Instead I would add the possible support to derived types, via the slot mechanism for instance. There is a little coding necessary to make the generic code handle the case of var-sized objects, but this is doable and not very complicated.

This may be really needed or not. if we can create the rule "every derived type can have weak-refs", this is simpler to memorize than "well, most can, some cannot".

With some (considerable?) effort, slots on var-sized objects can certainly be supported -- the same approach as used for dict should work. I expect it might slow down the normal case a bit, unless you define a new descriptor type just for this.

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list