next up previous contents
Next: 3.3 Lists and Tuples Up: 3 Primitive Data Structures Previous: 3.1 Collections and Iterators

3.2 Sequences

Collections in which the elements are ordered are derived from class Sequence. The elements of a sequence can be accessed via subscripting, though the efficiency of this operation varies with the particular kind of sequence. The index function gives the index of an element - for any value v in a list l , l[l.index(v)] == v .

Note that subscripts start an 1, not 0; the index function returns 0 if the element is not in this list.