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
MsgPacket.sender.__doc__ = 'Sender public key.'
AttributeError: readonly attribute
--
assignee: docs@python
components: Documentation
messages: 255121
nosy: Laur Joost, docs@python
priority: normal
severity: normal
status: open
title: namedtuple documentation
versions: Python 3.5
___
Python tracker
<http://bugs.python.org/issue25700>
___
___
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com