tuples vs lists

Peter Hansen peter at engcorp.com
Wed Sep 17 09:32:15 EDT 2003


Ivan Voras wrote:
> 
> 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.

That's your personal choice, I suppose, and I won't try any more to dissuade
you any more except to point out that most Python programmers, I believe, do 
not see tuples as their first choice, but use them only in certain special cases.

I could be wrong.  It happens.  ;-)

-Peter




More information about the Python-list mailing list