I
Ivan Voras
Are there any performance/size differences between using tuples and using
lists?
lists?
Are there any performance/size differences between using tuples and using
lists?
Ivan Voras said:Are there any performance/size differences between using tuples and using
lists?
Lukasz said:subsequent runs of of the script given below.
Ivan said:Ok, I gather touples should be smaller & faster as I thought
Peter said:Don't make a decision based on performance. Use tuples if you
require the immutability, or if you want to follow Guido's "advice"
(?) to treat them as simple unnamed structs.
Ivan said:I know that. I was just wandering if they also behave faster. Lists are only
interesting to me in case I need mutability.
Peter said:Ivan Voras wrote:
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*.
Ivan said: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.
Peter Hansen said: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.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.