liveBook · Manning

ICPO

ICPO is a mnemonic for Python attribute lookup order across an instance, its class, parent classes, and the object hierarchy.

How 2 Manning books explain it

Python Workout: 50 ten-minute exercises

A name-resolution order for locating attributes across an instance, its class, parent classes, and the object hierarchy.

How it is used
Guides reasoning about Python attribute access, methods, class attributes, inheritance, and subclass-specific behavior.
How deep it goes
Traces lookup from instance through class and parents to object, then applies it to shadowing, inheritance, and super without runtime internals.
Examples
Uses str.upper, Foo and Bar methods, Bowl.max_scoops, BigBowl overrides, and Employee calling Person.__init__.
What you can do after
Diagnose/debug attribute results, predict inherited method calls, avoid accidental shadowing, and reuse methods across subclasses.

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

Python Workout, Second Edition

ICPO is a mnemonic for Python attribute lookup order: instance, class, parents, and object.

How it is used
Explains Python attribute access, method retrieval, inheritance, class attributes, and instance shadowing.
How deep it goes
Works through lookup order, inheritance, shadowing, super, and subclass-specific class attributes without descending into descriptor internals.
Examples
Uses string methods, Person and Employee, and Bowl and BigBowl class attributes to demonstrate lookup and reuse.
What you can do after
Diagnose attribute-resolution surprises and design inherited methods that honor instance- or subclass-specific values.

Read how Python Workout, Second Edition explains ICPO →

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.