What is the difference between class attributes and instance attributes?
Object-oriented programming
Audio flashcard · 0:14Nortren·
What is the difference between class attributes and instance attributes?
0:14
Class attributes are defined directly in the class body and are shared by all instances. Instance attributes are set on individual instances, usually in init via self. When you access an attribute, Python looks first on the instance, then on the class, then on its base classes.
docs.python.org