property :: Class property
[hide private]
[frames] | no frames]

Class property


property(fget=None, fset=None, fdel=None, doc=None) -> property attribute

fget is a function to be used for getting an attribute value, and likewise
fset is a function for setting, and fdel a function for del'ing, an
attribute.  Typical use is to 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.")

Decorators make defining new properties or modifying existing ones easy:
class C(object):
    @property
    def x(self): return self._x
    @x.setter
    def x(self, value): self._x = value
    @x.deleter
    def x(self): del self._x

Instance Methods [hide private]
 
__delete__(descr, obj)
value
__get__(descr, obj, type=...)
 
__getattribute__(...)
x.__getattribute__('name') <==> x.name
property attribute

__init__(fget=None, fset=None, fdel=None, doc=None)
x.__init__(...) initializes x; see help(type(x)) for signature
a new object with type S, a subtype of T
__new__(T, S, ...)
 
__set__(descr, obj, value)
 
deleter(...)
Descriptor to change the deleter on a property.
 
getter(...)
Descriptor to change the getter on a property.
 
setter(...)
Descriptor to change the setter on a property.

Inherited from object: __delattr__, __format__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]
  fdel
  fget
  fset

Inherited from object: __class__

Method Details [hide private]

__getattribute__(...)

 
x.__getattribute__('name') <==> x.name
Overrides: object.__getattribute__

__init__(fget=None, fset=None, fdel=None, doc=None)
(Constructor)

 
x.__init__(...) initializes x; see help(type(x)) for signature
Returns:
property attribute

Overrides: object.__init__

__new__(T, S, ...)

 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__