SOLVED: Docstring parsing and formatting
Ben Finney
ben+python at benfinney.id.au
Tue Sep 18 08:34:11 EDT 2012
Joel Goldstick <joel.goldstick at gmail.com> writes:
> On Tue, Sep 18, 2012 at 1:03 AM, Terry Reedy <tjreedy at udel.edu> wrote:
> > On 9/17/2012 10:03 PM, Ben Finney wrote:
> >> Where can I find a standard implementation of the docstring parsing
> >> and splitting algorithm from PEP 257?
>
> Do you know about pydoc? I haven't looked at its source, but since it
> does a great job of printing documentation from docstrings it might
> contain what you need
Yes, I have now learned about the ‘pydoc’ module following the lead from
investigating the interactive interpreter's ‘help’ function
<URL:http://docs.python.org/library/pydoc.html>.
The ‘pydoc.splitdoc’ function, though not documented in the library
documentation, does what I need. It takes a docstring as input, and
returns a tuple of (synopsis, description).
Thanks to everyone who helped.
--
\ “Value your freedom or you will lose it, teaches history. |
`\ “Don't bother us with politics,” respond those who don't want |
_o__) to learn.” —Richard Stallman, 2002 |
Ben Finney
More information about the Python-list
mailing list