[Python-Dev] Ridiculously minor tweaks?

Christian Tismer tismer@tismer.com
Wed, 12 Mar 2003 15:46:55 +0100

Guido van Rossum wrote:
> Tuples are for heterogeneous data, list are for homogeneous data.
> Tuples are *not* read-only lists.
> Oh!
> Did you point that out anywhere, before, and I missed it?
> Yes.  I've been saying this for years whenever people would listen
> (which is not often :-( )


>>Are you thinking of lists as to be really somehow
>>being homogeneous data, in a sense to be replacible
>>by some array optimization, sometimes, while tuples aren't?
> Python is a dynamic language, and you can do whatever you want with
> the data structures it gives you.  But when thinking about extending
> the language with optional type declarations or automatic type
> inference, I always think of the type of a list as "list of T" while I
> think of a tuple's type as "tuple of length N with items of types T1,
> T2, T3, ..., TN".  So [1, 2] and [1, 2, 3] are both "list of int" (and
> "list of Number" and "list of Object", of course) while ("hello", 42)
> is a "2-tuple with items str and int" and (42, "hello", 3.14) is a
> "3-tuple with items int, str, float".

Oh yes, after re-thinking this, my question was
dumb. From my own usage of tuples and lists,
I know that I almost always use lists as collections
of objects of the same type, while tuples are often
used to group different things together.

Basically, I knew this all, and I'm asking
myself why I asked. Probably since I'm looking
at lists and tuples too much technically, these days.

cheers - chris

Christian Tismer             :^)   <mailto:tismer@tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  pager +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/