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


Groups > comp.lang.python > #29425

SOLVED: Docstring parsing and formatting

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'algorithm': 0.03; 'function,': 0.07; 'parsing': 0.07; '8bit%:30': 0.09; 'docstrings': 0.09; 'input,': 0.09; 'pep': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'sep': 0.09; 'splitting': 0.09; 'subject:parsing': 0.09; 'terry': 0.09; 'tuple': 0.09; 'looked': 0.10; 'library': 0.15; 'source,': 0.15; 'docstring': 0.16; 'finney': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'wrote:': 0.17; 'documented': 0.17; 'module': 0.19; "haven't": 0.23; 'header:User- Agent:1': 0.26; 'am,': 0.27; 'header:X-Complaints-To:1': 0.28; 'writes:': 0.29; 'function': 0.30; 'url:python': 0.32; 'to:addr :python-list': 0.33; 'everyone': 0.33; 'thanks': 0.34; 'ben': 0.35; 'pm,': 0.35; 'received:org': 0.36; 'but': 0.36; 'url:org': 0.36; 'url:library': 0.36; 'does': 0.37; 'subject:: ': 0.38; 'url:docs': 0.38; 'to:addr:python.org': 0.39; 'takes': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'your': 0.60; 'great': 0.64; 'learned': 0.65; 'lose': 0.71; '2002': 0.78; 'joel': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Ben Finney <ben+python@benfinney.id.au>
Subject SOLVED: Docstring parsing and formatting
Date Tue, 18 Sep 2012 22:34:11 +1000
References <7wk3vskrz6.fsf@benfinney.id.au> <k38vai$u02$1@ger.gmane.org> <CAPM-O+x62kkBAW=4UjfTZW_OGTgYDH4=dnr6L8xMi63LLhAXWg@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host rasputin.madmonks.org
X-Public-Key-ID 0xBD41714B
X-Public-Key-Fingerprint 9CFE 12B0 791A 4267 887F 520C B7AC 2E51 BD41 714B
X-Public-Key-URL http://www.benfinney.id.au/contact/bfinney-gpg.asc
X-Post-From Ben Finney <bignose+hates-spam@benfinney.id.au>
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)
Cancel-Lock sha1:+Pg5JGIlly5m1VxYjc2HPnLSbHs=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.869.1347971665.27098.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1347971665 news.xs4all.nl 6980 [2001:888:2000:d::a6]:43992
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:29425

Show key headers only | 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