LESSON 1.04 · 6 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW
Classes and attribute lookup
Watch Python search an instance, its class and the bases for an attribute.
Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 2 controls and 3 checks, in this lesson and every other.
Go Pro · $8.25/moEXPLAINER · 1.04 · CLASS BAY5 CLASSES · 5 BASE LINKS
01
Stage 1 of 6 · Define classes
Each class statement makes a class object with its own dict. D has two bases: B, then C.
Explain it simply
A class is an object too, and its box lists its dict of attributes. The arrows show bases, the classes each one builds on, ending at object on the right. D builds on B, then C, and both build on A, so A can be reached two ways. The next stage puts all five classes in one search order.
Five class objects. D has bases B and C. B and C have base A. A has base object. Each box lists its dict.
nameobject, dict (pale: after the stop)reference: name, base, __class__, __func__, __self__new row, search hit, resultdict read, no matchAttributeError
Toy: 4 classes + object · 1 instance · 6 statements · no property (1.06) · ids are stand-ins
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
A class statement calls type with a name, the bases and a dict.
PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
- 5 more stages and 2 live controls
- 2 mix-up cards and 3 predict-then-reveal checks
- Watch it as a narrated video, in three voices
- Every Pro lesson and capstone · 656 in total
$99 a year, or $15 a month. Cancel any time.