list vs tuple

Aahz Maruch aahz at panix.com
Wed Mar 28 09:44:27 EST 2001


In article <hGlw6.782$p5.3210 at news1.rivrw1.nsw.optushome.com.au>,
deadmeat <root@[127.0.0.1]> wrote:
>
>Whats the practical difference between a list[] and a tuple() ?
>
>A tuple seems to be a very basic list, so unless it's faster, what's the
>point of it?

As someone said, tuples are immutable.  This leads to useful
functionality, such as being able to easily use tuples as keys in
dictionaries (ditto strings).

While it's theoretically possible to use mutable variables as dict keys,
it creates icky problems.
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Androgynous poly kinky vanilla queer het Pythonista   http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

"Boost the stock market -- fire someone"



More information about the Python-list mailing list