[Python-checkins] cpython (merge 3.4 -> default): merge

raymond.hettinger python-checkins at python.org
Sun Aug 10 19:42:01 CEST 2014


http://hg.python.org/cpython/rev/147d778e65e8
changeset: 92065:147d778e65e8
parent: 92063:bda68f973228
parent: 92064:ebd6f7f7859f
user: Raymond Hettinger <python at rcn.com>
date: Sun Aug 10 10:41:52 2014 -0700
summary:
 merge
files:
 Doc/library/functions.rst | 20 +++++++++++++-------
 Misc/ACKS | 1 +
 2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1106,9 +1106,11 @@
 
 Return a property attribute.
 
- *fget* is a function for getting an attribute value, 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``::
+ *fget* is a function for getting an attribute value. *fset* is a function
+ for setting an attribute value. *fdel* is a function for deleting an attribute
+ value. And *doc* creates a docstring for the attribute.
+
+ A typical use is to define a managed attribute ``x``::
 
 class C:
 def __init__(self):
@@ -1116,13 +1118,16 @@
 
 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.")
 
- If then *c* is an instance of *C*, ``c.x`` will invoke the getter,
+ If *c* is an instance of *C*, ``c.x`` will invoke the getter,
 ``c.x = value`` will invoke the setter and ``del c.x`` the deleter.
 
 If given, *doc* will be the docstring of the property attribute. Otherwise, the
@@ -1138,8 +1143,9 @@
 """Get the current voltage."""
 return self._voltage
 
- turns the :meth:`voltage` method into a "getter" for a read-only attribute
- with the same name.
+ The ``@property`` decorator turns the :meth:`voltage` method into a "getter"
+ for a read-only attribute with the same name, and it sets the docstring for
+ *voltage* to "Get the current voltage."
 
 A property object has :attr:`~property.getter`, :attr:`~property.setter`,
 and :attr:`~property.deleter` methods usable as decorators that create a
@@ -1167,7 +1173,7 @@
 additional functions the same name as the original property (``x`` in this
 case.)
 
- The returned property also has the attributes ``fget``, ``fset``, and
+ The returned property object also has the attributes ``fget``, ``fset``, and
 ``fdel`` corresponding to the constructor arguments.
 
 
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -250,6 +250,7 @@
 Craig Citro
 Gilles Civario
 Chris Clark
+Diana Clarke
 Laurie Clark-Michalek
 Mike Clarkson
 Andrew Clegg
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /