list vs tuple

Sheila King sheila at spamcop.net
Wed Mar 28 20:17:51 EST 2001


On Wed, 28 Mar 2001 16:50:58 -0500, "Steve Holden" <sholden at holdenweb.com>
wrote in comp.lang.python in article
<O4tw6.6798$m04.497167 at e420r-atl1.usenetserver.com>:

:"Alex Martelli" <aleaxit at yahoo.com> wrote in message
:news:99teuu02p5f at news1.newsguy.com...

:> Actually, tuples have NO methods -- including those that would
:> require no mutability at all:

...<snipped>...

:> Note the lack of 'count' and 'index', which do not mutate a list
:> when applied to it, but are still missing from tuples.
:>
:So, tuples are not only immutable, they are also uncooperative.

Tuples can be used as keys in dictionaries. Lists cannot.

--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/




More information about the Python-list mailing list