Lists and Tuples

David Eppstein eppstein at ics.uci.edu
Fri Dec 5 06:45:23 CET 2003


In article <7x7k1b4yqn.fsf at ruckus.brouhaha.com>,
 Paul Rubin <http://phr.cx@NOSPAM.invalid> wrote:

> Try this with a list:
> 
>   a = [1, 2, 3, 4, 5]
>   a[3] = 27
>   print a
> 
> Then try it with a tuple.

That's true, but another answer is: you should use tuples for short 
sequences of diverse items (like the arguments to a function).  You 
should use lists for longer sequences of similar items.

-- 
David Eppstein                      http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science




More information about the Python-list mailing list