pydoc > builtins.property

πŸ“˜ Help on class property in builtins:

πŸš€ Quick Reference

Use Case Command Description
Define a property with getter/setter/deleter property(getx, setx, delx, "doc") Create a managed attribute with explicit get, set, delete functions
Define a property using decorator @property Simplified property definition; getter returns an attribute
Define a setter for a property @x.setter Decorate a method to act as the property’s setter
Define a deleter for a property @x.deleter Decorate a method to act as the property’s deleter

πŸ“– Description

builtins.property = class property(object)

builtins.property(fget=None, fset=None, fdel=None, doc=None)

Property attribute.

πŸ“ Typical Use

Define a managed attribute x:

class C(object):
    def getx(self): return self._x
    def setx(self, value): self._x = value
    def delx(self): del self._x
    x = property(getx, setx, delx, "I'm the 'x' property.")

🎨 Decorator Syntax

Decorators make defining new properties or modifying existing ones easy:

class C(object):
    @property
    def x(self):
        "I am the 'x' property."
        return self._x
    @x.setter
    def x(self, value):
        self._x = value
    @x.deleter
    def x(self):
        del self._x

πŸ› οΈ Methods


βš™οΈ Static Methods


πŸ“Š Data Descriptors

builtins.property
πŸš€ Quick Reference πŸ“– Description
πŸ“ Typical Use 🎨 Decorator Syntax
πŸ› οΈ Methods βš™οΈ Static Methods πŸ“Š Data Descriptors

Generated by phpman v4.10.0-7-g98e9fd5 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-01 20:04 @216.73.216.239
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!

^_top_^