[Tutor] Distinction between tuples and lists

Christopher Mutel cmutel at gmail.com
Thu Jan 1 15:07:00 CET 2009


Hello all-

I stumbled across some discussion of why the fundamental difference
between lists and tuples is not mutability, but hetero- versus
homogeneous data, e.g.

http://jtauber.com/blog/2006/04/15/python_tuples_are_not_just_constant_lists/

http://pyre.third-bit.com/blog/archives/000450.html

However, after reading the cited discussions, my python books, etc., I
have to admit I don't really understand this idea. What does it mean
that "lists are intended for homogeneous sequences"? What is different
about lists that would make them more suited for homogeneous sequences
than heterogeneous sequences (or vice-versa for tuples)? In the end,
from what I understand, the idea of homo/heterogeneity seems
orthogonal to mutability, which is the main distinction emphasized by
e.g. Learning Python.

I would greatly appreciate any help provided,

-Chris Mutel


More information about the Tutor mailing list