6.1. Sequences

Sequence types all share the same access model: ordered set with sequentially-indexed offsets to get to each element. Multiple elements may be achieved by using the slice operators which we will explore in this chapter. The numbering scheme used starts from zero (0) and ends with one less the length of the sequence—the reason for this is because we began at 0. Figure 6-1 illustrates how sequence items are stored.

Figure 6.1. How Sequence Elements Are Stored and Accessed

6.1.1. Operators

A list of all the operators applicable to all sequence types is given in Table6.1. The operators appear in hierarchical order from highest ...

Get Core Python Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.