list vs tuple
f8dy at yahoo.com
Wed Mar 28 20:18:00 CEST 2001
"Aahz Maruch" <aahz at panix.com> wrote in message
news:99stcb$483$1 at panix6.panix.com...
> In article <hGlw6.782$p5.3210 at news1.rivrw1.nsw.optushome.com.au>,
> deadmeat <firstname.lastname@example.org> wrote:
> >Whats the practical difference between a list and a tuple() ?
> As someone said, tuples are immutable. This leads to useful
> functionality, such as being able to easily use tuples as keys in
> dictionaries (ditto strings).
It was my understanding that only tuples containing immutable objects could
be used as dictionary keys. For instance, (1,2,3) can be, and ("a","b","c")
can be, but ([1,2,3], ["a","b","c"]) can not, because the underlying objects
could mutate and cause problems. (Wow, that sounds like a bad sci-fi
movie.) Is this true?
You're smart; why haven't you learned Python yet?
More information about the Python-list