From ef153618d6869db43cf84acd0b2268e948c055e2 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Sun, 24 Nov 2013 14:43:04 -0800 Subject: [PATCH] Document that @property can incorporate a docstring from the getter method. Improve readabilty with additional whitespace. --- Objects/descrobject.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Objects/descrobject.c b/Objects/descrobject.c index 7bf1859483..3bd22762b6 100644 --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -1363,21 +1363,25 @@ PyDoc_STRVAR(property_doc, "\n" "fget is a function to be used for getting an attribute value, and likewise\n" "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" +"attribute. Typical use is to define a managed attribute x:\n\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.\")\n" "\n" -"Decorators make defining new properties or modifying existing ones easy:\n" +"Decorators make defining new properties or modifying existing ones easy:\n\n" "class C(object):\n" " @property\n" -" def x(self): return self._x\n" +" def x(self):\n" +" \"\I am the 'x' property.\"\n" +" return self._x\n" " @x.setter\n" -" def x(self, value): self._x = value\n" +" def x(self, value):\n" +" self._x = value\n" " @x.deleter\n" -" def x(self): del self._x\n" +" def x(self):\n" +" del self._x\n" ); static int -- 2.50.1