diff -r c62fa6892424 Doc/tutorial/datastructures.rst --- a/Doc/tutorial/datastructures.rst Thu May 17 19:49:27 2012 +0200 +++ b/Doc/tutorial/datastructures.rst Fri May 18 16:59:00 2012 -0500 @@ -366,6 +366,18 @@ effect with slicing and concatenation, though). It is also possible to create tuples which contain mutable objects, such as lists. +It may seem that tuples are very similar to lists (and they are in many ways), +but their immutability makes them ideal for some cases that lists don't fit +quite as well. Though hetero- or homogeneity is in no way a programmed property +of anything in Python's syntax or the standard library, it can be helpful to +think of tuples as heterogenous structures, and lists as homogenous sequences. +When used in this way, tuples are used as a coherent unit while lists are used +one member at a time. This is not to say tuples can only be used as a +heterogenous structure. In fact, there are parts of Python's own syntax that +require a tuple that happens to be a homogenous sequence, such as the +:keyword:`except` clause of a ``try ... except`` statement, :func:`issubclass`, +and :func:`isinstance`. + A special problem is the construction of tuples containing 0 or 1 items: the syntax has some extra quirks to accommodate these. Empty tuples are constructed by an empty pair of parentheses; a tuple with one item is constructed by