Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 97fc2ba

Browse files
committed
Document that @Property can incorporate a docstring from the getter method. Improve readabilty with additional whitespace.
1 parent 45059eb commit 97fc2ba

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

Objects/descrobject.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,21 +1512,25 @@ PyDoc_STRVAR(property_doc,
15121512
"\n"
15131513
"fget is a function to be used for getting an attribute value, and likewise\n"
15141514
"fset is a function for setting, and fdel a function for del'ing, an\n"
1515-
"attribute. Typical use is to define a managed attribute x:\n"
1515+
"attribute. Typical use is to define a managed attribute x:\n\n"
15161516
"class C(object):\n"
15171517
" def getx(self): return self._x\n"
15181518
" def setx(self, value): self._x = value\n"
15191519
" def delx(self): del self._x\n"
15201520
" x = property(getx, setx, delx, \"I'm the 'x' property.\")\n"
15211521
"\n"
1522-
"Decorators make defining new properties or modifying existing ones easy:\n"
1522+
"Decorators make defining new properties or modifying existing ones easy:\n\n"
15231523
"class C(object):\n"
15241524
" @property\n"
1525-
" def x(self): return self._x\n"
1525+
" def x(self):\n"
1526+
" \"\I am the 'x' property.\"\n"
1527+
" return self._x\n"
15261528
" @x.setter\n"
1527-
" def x(self, value): self._x = value\n"
1529+
" def x(self, value):\n"
1530+
" self._x = value\n"
15281531
" @x.deleter\n"
1529-
" def x(self): del self._x\n"
1532+
" def x(self):\n"
1533+
" del self._x\n"
15301534
);
15311535

15321536
static int

0 commit comments

Comments
 (0)