On Wed, Jun 11, 2008 at 03:28:01PM +0300, Omer Zak wrote: > I have a silly question: > Why does Python have both Tuples and Lists? > > The only programmer-visible difference, of which I am aware, between > them is that Tuples are immutable and Lists are mutable, with the > following implications: > 1. Tuples can be used as hash (Dict) keys, and Lists cannot. > 2. When you modify a Tuple, a new Tuple is created. On the other hand, > List modification happens in place. > > I don't see why is the above difference good enough reason to have > different notations for Tuples and Lists.
I'm not sure what you are suggesting? 1. Not having tuples, only lists. And then you wouldn't be able to use lists or tuples as dict keys, and wouldn't be able to do tuple assignment 2. Not having lists, only tuples. And then you would be able to use them as dict keys all you want, but you wouldn't be able to modify their members in place. 3. Have both both tuples and lists, but have a different syntax for handling them than Python currently has. Which was it? _______________________________________________ Python-il mailing list [email protected] http://hamakor.org.il/cgi-bin/mailman/listinfo/python-il
