diff options
author | Christian Heimes <christian@cheimes.de> | 2007-11-12 01:15:40 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2007-11-12 01:15:40 (GMT) |
commit | 3d4c316f174d72c9b0db7e5bf75e0447c36f895c (patch) | |
tree | aeadf60a74be1183fbeee9b24f0761a7f84b6670 /Objects/descrobject.c | |
parent | 03c1d1e9c4bad8814d11060dc28942a7819f4814 (diff) | |
download | cpython-3d4c316f174d72c9b0db7e5bf75e0447c36f895c.zip cpython-3d4c316f174d72c9b0db7e5bf75e0447c36f895c.tar.gz cpython-3d4c316f174d72c9b0db7e5bf75e0447c36f895c.tar.bz2 |
Added new decorator syntax to property.__doc__
Guido prefers _x over __x.
Diffstat (limited to 'Objects/descrobject.c')
-rw-r--r-- | Objects/descrobject.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Objects/descrobject.c b/Objects/descrobject.c index 535a49f..094bf71 100644 --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -1268,10 +1268,20 @@ PyDoc_STRVAR(property_doc, "fset is a function for setting, and fdel a function for del'ing, an\n" "attribute. Typical use is to define a managed attribute x:\n" "class C(object):\n" -" def getx(self): return self.__x\n" -" def setx(self, value): self.__x = value\n" -" def delx(self): del self.__x\n" -" x = property(getx, setx, delx, \"I'm the 'x' property.\")"); +" def getx(self): return self._x\n" +" def setx(self, value): self._x = value\n" +" def delx(self): del self._x\n" +" x = property(getx, setx, delx, \"I'm the 'x' property.\")\n" +"\n" +"Decorators makes defining new or modifying existing properties easy:\n" +"class C(object):\n" +" @property\n" +" def x(self): return self._x\n" +" @x.setter\n" +" def x(self, value): self._x = value\n" +" @x.deleter\n" +" def x(self): del self._x\n" +); static int property_traverse(PyObject *self, visitproc visit, void *arg) |