liveBook · Manning

Indexable type

An indexable type is a type whose values support selecting elements or subsequences using an integer index or slice.

How 2 Manning books explain it

Python Workout: 50 ten-minute exercises

An indexable type is a type whose values support selecting an element or subsequence by a numeric index or slice.

How it is used
Unifies functions across strings, lists, tuples, and other values supporting indexes or slices.
How deep it goes
Defines indexing and slicing, explains their reuse, and stops at exercise-level applications rather than implementation internals.
Examples
Uses mylist[-3:], even-odd sums, alternating arithmetic, and a partial zip implementation.
What you can do after
Apply indexes and slices to write functions that handle multiple compatible data types.

Read how Python Workout: 50 ten-minute exercises explains indexable type →

Python Workout, Second Edition

An indexable type is a type whose values support access by an integer index or a slice.

How it is used
Promotes reusable functions that accept strings, lists, tuples, or other indexable values.
How deep it goes
Defines indexing and slicing, demonstrates negative slices, and stops short of implementation internals.
Examples
Uses final-element slicing, substring access, index-parity sums, alternating arithmetic, and partial zip emulation.
What you can do after
Apply it via reusable Python functions that index or slice multiple sequence types.

Read how Python Workout, Second Edition explains indexable type →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.