"Tuples are for heterogeneous data, lists are for homogeneous data."
Jack Diederich
jack at performancedrivers.com
Tue Mar 11 22:14:20 EST 2003
On Tue, Mar 11, 2003 at 09:59:34PM -0500, Arthur wrote:
> The subject line is a Guido quote from today's dev list.
>
> Is the point Guido making performance related, or is it something else? I
> have used lists extensively for heterogenous data, and wonder what it is I
> am losing by so doing.
I read the same thing, and was a little confused too.
He may mean tuples are meant to be typed, and lists generated.
So you end up with a cononical tuple of Foo's because you typed out a tuple
of Foo's. Lists tend to accumulate more random members.
I don't pretend to channel Guido, that is just my guess.
There was a post (maybe in the byte-code python-dev thread?) that lists
are actually faster for access than tuples. This is because lists are
more common so the common case is optmized. I would assume that tuples are
cheaper to instantiate.
-jackdied
More information about the Python-list
mailing list