Classes and objects
A class describes a new kind of value, what each one holds and what it can do; objects are the values made from it, each with its own attributes.
Depth 1 · Foundation
You can write a class with `__init__`, attributes and methods, make objects from it, and know that each object has its own attributes and that `self` is the object a method was called on; you give a class a `__str__`, and use `@dataclass` for classes that mostly hold data.
Sign in to prove what you know with a short quiz, see how deep you've gone, and earn XP for it.
Sign in with GoogleDepths of understanding
- 1
Foundation
You can write a class with `__init__`, attributes and methods, make objects from it, and know that each object has its own attributes and that `self` is the object a method was called on; you give a class a `__str__`, and use `@dataclass` for classes that mostly hold data.
Your path here
What's still between you and Classes and objects, depth 1, in the order you can learn it.
- 1ProgramDepth 1 · Foundation · Program Basics
- 2ExpressionDepth 1 · Foundation · Program Basics
- 3Variables in codeDepth 1 · Foundation · Program Basics
- 4Program stateDepth 1 · Foundation · Program Basics
- 5Input and outputDepth 1 · Foundation · Program Basics
- 6Functions in codeDepth 1 · Foundation · Functions
- 7Return valuesDepth 1 · Foundation · Functions
- 8BooleansDepth 1 · Foundation · Control Flow
- 9ConditionalsDepth 1 · Foundation · Control Flow
- 10LoopsDepth 1 · Foundation · Control Flow
- 11Accumulator patternDepth 1 · Foundation · Control Flow
- 12Floating-point numbersDepth 1 · Foundation · Data Types
- 13Basic typesDepth 1 · Foundation · Data Types
- 14Character encodingDepth 1 · Foundation · Data Types
- 15StringsDepth 1 · Foundation · Data Types
- 16ListsDepth 1 · Foundation · Data Structures
- 17DictionariesDepth 1 · Foundation · Data Structures
- 18Classes and objectsDepth 1 · Foundation · Objects and Classes
Where it fits
This concept
Opens up
Makes these deeper
Once you know Classes and objects, come back to these — they'll mean more.