Python — From Basics to Advanced · OOP — Object-Oriented Programming
Property and Encapsulation
OOP — Object-Oriented Programming
Introduction
Python's @property lets you hide logic behind an attribute. From the outside, obj.price looks like a plain attribute, but under the hood it can call a method with validation.