tuples vs lists

Ivan Voras ivoras at fer.hr
Wed Sep 17 07:44:40 EDT 2003


Peter Hansen wrote:
> Ivan Voras wrote:

>> I know that. I was just wandering if they also behave faster. Lists
>> are only interesting to me in case I need mutability.
>
> I'd suggest you have that backwards.  Lists should _always_ be
> interesting
> to you.  Tuples should be interesting only in the case where you need
> *immutability*.

I disagree. :) I would always use tuples except when I explicitely need
mutability. That doesn't meen that I would intentionaly (badly) restructure
code just to use tuples, only that in many cases my structures don't need to
be modified.

-- 
-- 
Every sufficiently advanced magic is indistinguishable from technology
   - Arthur C Anticlarke






More information about the Python-list mailing list