Property decorator
In Python, a property decorator exposes a method through attribute-like access while enabling computed, validated, or otherwise managed values.
The Well-Grounded Python Developer: How the pros use Python and Flask
A Python property decorator defines attribute-like access backed by methods that can compute, validate, or otherwise control attribute values.
- How it is used
- Keeps rectangle coordinate updates readable while controlling access and movement at screen boundaries.
- How deep it goes
- Works through a getter and boundary-aware setter, contrasting them with explicit methods; does not develop an exhaustive property reference.
- Examples
- Uses a moving rectangle, contrasting direct coordinate updates with explicit getter and setter calls.
- What you can do after
- Apply it via Python’s `@property` and `@x.setter` decorators to control coordinate updates without changing callers’ attribute syntax.
Software Design for Python Programmers
The Python property decorator converts a method into a managed attribute interface backed by getter, setter, or deleter methods.
- How it is used
- Uses properties to hide class implementations while providing controlled, attribute-like access to object state.
- How deep it goes
- Explains getter creation, read-only behavior, calculated values, setter validation, and implementation substitution without covering deleters.
- Examples
- Demonstrates Book attributes, Circle calculations, and Item.price validation through concrete Python listings.
- What you can do after
- Build it from scratch by exposing attributes through getters and adding validating setters without leaking storage details.
Read how Software Design for Python Programmers explains property decorator →
Related concepts
- accessor methodimplements · An accessor method or function provides access to an object's property or state by retrieving its value, assigning a value, or defining behavior for such access.
- attributeproduces · An attribute is a named property, value, or piece of information associated with an entity, object, or program element.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

