[Tutor] Distinction between tuples and lists
kent37 at tds.net
Thu Jan 1 22:47:10 CET 2009
On Thu, Jan 1, 2009 at 1:59 PM, Alan Gauld <alan.gauld at btinternet.com> wrote:
> lists/tuples serve many purposes in Python but one thing they most
> do not do is act as hetero/homogenous containers. The authors of the blogs
> may wish otherwise and indeed their debate seems to be geared around
> what they would like to see in Python3000 rather than whats there now.
For what it's worth, Guido has explicitly said,
"Tuples are for heterogeneous data, list are for homogeneous data.
Tuples are *not* read-only lists."
This statement kicked off a very long thread on the python-dev list.
For a summary of the discussion, and links to more of it, see the
section "Ridiculously minor tweaks?" here:
Personally, I take this with a grain of salt. I do tend to use tuples
for things that are like records or structs, or often just for pairs
of data (e.g. the elements of dict.items()), and lists for homogeneous
collections, but that is more a matter of fitness for the purpose than
More information about the Tutor