Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #29425

SOLVED: Docstring parsing and formatting

From Ben Finney <ben+python@benfinney.id.au>
Subject SOLVED: Docstring parsing and formatting
Date 2012-09-18 22:34 +1000
References <7wk3vskrz6.fsf@benfinney.id.au> <k38vai$u02$1@ger.gmane.org> <CAPM-O+x62kkBAW=4UjfTZW_OGTgYDH4=dnr6L8xMi63LLhAXWg@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.869.1347971665.27098.python-list@python.org> (permalink)

Show all headers | View raw


Joel Goldstick <joel.goldstick@gmail.com> writes:

> On Tue, Sep 18, 2012 at 1:03 AM, Terry Reedy <tjreedy@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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

SOLVED: Docstring parsing and formatting Ben Finney <ben+python@benfinney.id.au> - 2012-09-18 22:34 +1000

csiph-web