Lists and Tuples
mwilson at the-wire.com
Fri Dec 5 17:13:19 CET 2003
In article <bqpfde$426$0 at 220.127.116.11>, bokr at oz.net (Bengt Richter) wrote:
>On Thu, 04 Dec 2003 21:45:23 -0800, David Eppstein <eppstein at ics.uci.edu> wrote:
>>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?
To me, it's a distinction without a difference. Tuples
*act* like immutable sequences, and I use them that way. I
don't know, though, that I won't get caught some day.
Python 3.3 (#22, Jul 29 2013, 14:34:42) [MSC v.9200 96 bit (Intel)] on win96
Type "help", "copyright", "credits" or "license" for more information.
>>> t = (1,4,7,34,789)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
HomogeneityError: tuple elements are not diverse
More information about the Python-list