Controlling attribute access
Python commonly uses public attributes, naming conventions and properties rather than strict private-field syntax. A property lets an object expose attribute-style access while controlling how a value is calculated or validated.
Validation belongs near the invariant
If a product price can never be negative, the object can enforce that rule when the value is assigned. This prevents invalid state from spreading through the rest of the application.
Do not add getters and setters by habit
A normal public attribute is often perfectly appropriate. Introduce a property when validation, calculation, conversion or compatibility with an existing API provides a real benefit.
Practice: create an employee salary property that rejects negative values and exposes an annual salary calculation.