OTHER SEQUENCE TYPES IN PYTHON
Python supports seven sequence types: str, unicode, list, tuple, bytearray, buffer, and xrange.
You can iterate through a sequence and retrieve the position index and corresponding value at the same time using the enumerate() function.
>>> for i, v in enumerate(['x', 'y', 'z']):
...     print i, v
...
0 x
1 y
2 z
Bytearray objects are created with the built-in function bytearray(). Although buffer objects are not directly supported by Python syntax, you can create them via the built-in buffer() function.
Objects of type xrange are created with the xrange() function. An xrange object is similar to a buffer in the sense that there is no specific syntax to create them. Moreover, xrange objects do not support operations such as slicing, concatenation, or repetition.
At this point, you have seen all the Python types that you will encounter in the remaining chapters of this book. In addition...