tuples or lists

beliavsky at aol.com beliavsky at aol.com
Tue Mar 16 15:08:15 EST 2004


Tuples, unlike lists, are immutable, which I crudely translate to mean
"their contents cannot be changed". Out of habit, I use only lists,
not tuples, in my code. But I wonder if this is poor style -- putting
a collection of data in a tuple, when possible, makes it easier to
follow the code. You do not have to think about whether contents have
changed from where the tuple was first defined.

Is "use tuples instead of lists, when possible" a good rule?



More information about the Python-list mailing list