An attribute is a named value or behavior accessed through an object. In Python, dot notation reads an attribute, assigns a value, or calls a method: `circle.radius`, `circle.radius = 5`, or `circle.area()`. section 15.1.1 section 3.6
class Circle:
pass
my_circle = Circle()
my_circle.radius = 5
print(2 * 3.14 * my_circle.radius)
31.4
The `radius` attribute is created by assigning to the `Circle` instance. Reading it through the same instance supplies the value used in the calculation. section 15.1.1
An instance variable belongs to a particular object. Assigning `self.radius = 1` in `__init__` gives each new instance its own `radius`; assigning `circle.radius = 5` later changes that instance. Inside a method, write `self.radius` to reach the attribute. Bare `radius` refers to a local variable instead. section 15.2 section 15.1.1
Two attribute lookups deserve care:
- If an instance has no attribute of a given name, lookup can return a class variable with that name. Assigning through the instance creates an instance variable instead of changing the class variable; assign through the class to change the shared value. section 15.4.1
- A subclass instance can access inherited methods and class variables. Methods defined in either the parent or child that use `self.x` on that instance refer to the same instance variable. section 15.7
Use a property when ordinary dot access should run code. A method decorated with `@property` supplies the value when the attribute is read. Without a setter, the property is read-only; a method decorated with `@name.setter` handles assignment. This lets a plain instance variable become a computed or checked attribute without changing how callers access it. section 15.10
A computed temperature attribute
A `Temperature` object can store Fahrenheit in `self._temp_fahr` while exposing Celsius as `temp`. Its `@property` getter converts the stored value on a read; its `@temp.setter` converts a Celsius assignment back to Fahrenheit. With `_temp_fahr` initially `0`, reading `t.temp` gives about `-17.78`; after `t.temp = 34`, reading `t.temp` gives `34.0`. Both operations retain ordinary dot syntax. section 15.10

























