Lists and Tuples

Bengt Richter bokr at oz.net
Fri Dec 5 09:25:18 CET 2003


On Thu, 04 Dec 2003 21:45:23 -0800, David Eppstein <eppstein at ics.uci.edu> wrote:

>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.
>
I'm curious what you're getting at. I.e., what does diversity or
similarity have to do with the choice? Is that an aesthetic thing?
(In which case 'should' should be qualified a bit, IWT ;-)
Or what am I missing?

Regards,
Bengt Richter




More information about the Python-list mailing list