Property In Python

bayerj bayerj at in.tum.de
Fri Apr 21 05:30:48 EDT 2006


>>> print property.__doc__
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.")




More information about the Python-list mailing list