list vs tuple

Erik Max Francis max at alcyone.com
Wed Mar 28 11:09:55 EST 2001


deadmeat 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?

A list is mutable, whereas a tuple is immutable.  That means that
tuples, for instance, cannot be changed behind your back through other
references, and that tuples can be used as dictionary keys where lists
can't.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ 'Tis man's to fight, but Heaven's to give success.
\__/ Homer
    REALpolitik / http://www.realpolitik.com/
 Get your own customized newsfeed online in realtime ... for free!



More information about the Python-list mailing list