summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2015-05-13 08:09:59 (GMT)
committerRaymond Hettinger <python@rcn.com>2015-05-13 08:09:59 (GMT)
commiteac503aeac6fedc81001b9e1136957d45b9a2c51 (patch)
tree9b39bdd76843421487a78e56b2eb50c548e47d04 /Doc/library
parentf2244eaf9e3148d6270839e9aa7c2ad9752c17ed (diff)
downloadcpython-eac503aeac6fedc81001b9e1136957d45b9a2c51.zip
cpython-eac503aeac6fedc81001b9e1136957d45b9a2c51.tar.gz
cpython-eac503aeac6fedc81001b9e1136957d45b9a2c51.tar.bz2
Issue #24064: Property() docstrings are now writeable.
(Patch by Berker Peksag.)
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/collections.rst9
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
index dd6395d..892f05d 100644
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -924,6 +924,15 @@ create a new named tuple type from the :attr:`_fields` attribute:
>>> Point3D = namedtuple('Point3D', Point._fields + ('z',))
+Docstrings can be customized by making direct assignments to the ``__doc__``
+fields:
+
+ >>> Book = namedtuple('Book', ['id', 'title', 'authors'])
+ >>> Book.__doc__ = 'Hardcover book in active collection'
+ >>> Book.id = '13-digit ISBN'
+ >>> Book.title = 'Title of first printing'
+ >>> Book.author = 'List of authors sorted by last name'
+
Default values can be implemented by using :meth:`_replace` to
customize a prototype instance: