[Tutor] Distinction between tuples and lists
Kent Johnson
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
> definitely
> 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."
http://mail.python.org/pipermail/python-dev/2003-March/033964.html
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:
http://groups.google.com/group/comp.lang.python.announce/browse_thread/thread/b2a1ea28a26b3dfb/b2d17a69541e886b?lnk=gst
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
dogma.
Kent
More information about the Tutor
mailing list