← All terms · OOP
Property
`@property` turns a method into a read-only attribute. Accessed without parentheses; computed on demand. Common when the value derives from other state.
@property def area(self): return self.r ** 2 * 3.14
Learn this interactively:
Open lesson lesson-86 →Related — OOP
ClassA blueprint for objects. Created with `class Foo:`. Defines attributes + methods…InstanceA specific object built from a class. `dog = Dog()` makes one instance of `Dog`.selfThe current instance, passed implicitly as the first argument to methods. By con…__init__The constructor — runs when you call the class. Used to set instance attributes.Dunder methodsDouble-underscore methods that hook into Python syntax: `__add__`, `__len__`, `_…InheritanceA class can inherit attributes and methods from a parent class: `class Dog(Anima…