Q17: How does the @property decorator manage encapsulation?

The @property decorator converts a method into a read-only attribute getter. Paired with @<name>.setter and @<name>.deleter, it enforces encapsulation and input validation without changing public interface attribute access syntax.

Key Takeaways
  • Provides getter/setter encapsulation with standard attribute access syntax.
  • Enables read-only or validated instance attributes.
Knowledge Check

How do clients access a property method named 'balance' decorated with @property?