Tuples

François Pinard pinard at iro.umontreal.ca
Tue Feb 1 15:16:05 EST 2000


scarblac-spamtrap at pino.selwerd.nl (Remco Gerlich) writes:

> Fredrik Lundh wrote in comp.lang.python:
> > T = 1, 2, 3
> > L = list(T)
> > ... modify list in place
> > T = tuple(L)
> > 
> > (note: this is more efficient than it may seem -- the
> > list() and tuple() functions copy references, not the
> > objects themselves).

> Thanks! Never heard of those. Useful.

Yet, if T and L both exist, and L is modified, a copy *ought* to be done
somewhere, the copy might not just be done "in place"...

Maybe, then, that these functions are not as efficient as they seem? :-)

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard






More information about the Python-list mailing list