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

Skip to content

Commit 850be0f

Browse files
committed
Improve namedtuple doc string examples
1 parent 5e2e700 commit 850be0f

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

Doc/library/collections.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -929,10 +929,10 @@ Docstrings can be customized by making direct assignments to the ``__doc__``
929929
fields:
930930

931931
>>> Book = namedtuple('Book', ['id', 'title', 'authors'])
932-
>>> Book.__doc__ = 'Hardcover book in active collection'
932+
>>> Book.__doc__ += ': Hardcover book in active collection'
933933
>>> Book.id.__doc__ = '13-digit ISBN'
934934
>>> Book.title.__doc__ = 'Title of first printing'
935-
>>> Book.author.__doc__ = 'List of authors sorted by last name'
935+
>>> Book.authors.__doc__ = 'List of authors sorted by last name'
936936

937937
Default values can be implemented by using :meth:`_replace` to
938938
customize a prototype instance:

Doc/whatsnew/3.5.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ and improves their substitutability for lists.
865865
Docstrings produced by :func:`~collections.namedtuple` can now be updated::
866866

867867
Point = namedtuple('Point', ['x', 'y'])
868-
Point.__doc__ = 'ordered pair'
868+
Point.__doc__ += ': Cartesian coodinate'
869869
Point.x.__doc__ = 'abscissa'
870870
Point.y.__doc__ = 'ordinate'
871871

0 commit comments

Comments
 (0)