[New-bugs-announce] [issue25700] namedtuple documentation
Laur Joost
report at bugs.python.org
Sun Nov 22 19:44:40 EST 2015
New submission from Laur Joost:
collections.namedtuple documentation has an example about changing the resulting class docstrings:
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'
This seems to work for the resulting class, but not the field names:
MsgPacket = namedtuple('MsgPacket', ['sender', 'target', 'sig', 'ser_msg'])
MsgPacket.__doc__ = '. Message packet format. This is the data added to client queues.'
MsgPacket.sender.__doc__ = 'Sender public key.'
gives
Traceback (most recent call last):
File "C:/UTCloud/UT/DS/S11/server.py", line 42, in <module>
MsgPacket.sender.__doc__ = 'Sender public key.'
AttributeError: readonly attribute
----------
assignee: docs at python
components: Documentation
messages: 255121
nosy: Laur Joost, docs at python
priority: normal
severity: normal
status: open
title: namedtuple documentation
versions: Python 3.5
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25700>
_______________________________________
More information about the New-bugs-announce
mailing list