[New-bugs-announce] [issue7913] Enhance Cmd support for docstrings and document it.

R. David Murray report at bugs.python.org
Thu Feb 11 19:57:22 CET 2010


New submission from R. David Murray <rdmurray at bitdance.com>:

Cmd currently has undocumented support for using the docstrings of 'do_' methods as the documentation for those methods.  This is a very convenient facility, except that it leads to documentation being printed with a lot of leading whitespace.

I propose to enhance the docstring support to strip the leading whitespace from the docstring, and to document this facility.  The proposed stripping algorithm is to strip a number of characters equal to the whitespace on the first non-blank line of the docstring.  This means that existing docstrings, which will typically start right after the first """, will be displayed as they were previously, but that a docstring can be formatted by starting the documentation on a new line after the """, and whitespace will be properly stripped.

Patch attached with test and documentation update.

----------
components: Library (Lib)
files: cmd_doctest_enhancement.patch
keywords: patch
messages: 99233
nosy: r.david.murray
priority: normal
severity: normal
stage: patch review
status: open
title: Enhance Cmd support for docstrings and document it.
type: feature request
versions: Python 3.2
Added file: http://bugs.python.org/file16213/cmd_doctest_enhancement.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7913>
_______________________________________


More information about the New-bugs-announce mailing list