[Python-il] The Tuples and Lists question
w1 at zak.co.il
Wed Jun 11 15:28:01 IDT 2008
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
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.
Every good master plan involves building a time machine. Moshe Zadka
My own blog is at http://www.zak.co.il/tddpirate/
My opinions, as expressed in this E-mail message, are mine alone.
They do not represent the official policy of any organization with which
I may be affiliated in any way.
WARNING TO SPAMMERS: at http://www.zak.co.il/spamwarning.html
More information about the Python-il