tuples vs lists

Steve Horsley shoot at the.moon
Sat Jan 8 15:36:09 CET 2005


worzel wrote:
> I get what the difference is between a tuple and a list, but why would I 
> ever care about the tuple's immuutability?

Mainly for security and speed. Many library functions return info by returning
a reference to an internally held tuple, and could be damaged / compromised
/ corrupted if that internal data was modified by malicious code. If tuples
were mutable (lists) then it would be necessary to return a copy instead.

> Also, do you say 'too-ple' or 'chu-ple' - if you get my drift. (tomato or 
> tomato kind of thing)

Try 'Two-pull'.

Steve



More information about the Python-list mailing list