vs. ()
culliton at clark.net
Tue Mar 14 15:44:13 CET 2000
You're missing the critical mutable/immutable distinction. Tuples can
be used as dictionary keys since they are immutable. They can also be
used to get pass by value semantics (even though values are actually
always passed by reference) when calling functions since you know that
they can't be modified by the called function. Not to mention that
they're somewhat more efficient. It seems like I'm forgetting another
use for their immutablility, but thats already more than enough
rationale for their existance.
In article <pWrz4.47312$3b6.200194 at ozemail.com.au>,
Jason Stokes <jstok at bluedog.apana.org.au> wrote:
>Michal Bozon wrote in message ...
>>Could anyone tell me the difference between tuples and lists? (except from
>>that a list has few methods (append, extend, remove...) and tuple
>Well, that's the difference. In an object oriented language, objects differ
>by their interfaces. Tuples are fixed size ordered collections of objects,
>and lists are variable sized ordered collections.
More information about the Python-list