[Python-Dev] Best practice for documentation for std lib

Eli Bendersky eliben at gmail.com
Sun Sep 22 14:54:57 CEST 2013


On Sat, Sep 21, 2013 at 8:13 PM, Steven D'Aprano <steve at pearwood.info>wrote:

> Hi all,
>
> I have a question about how I should manage documentation for the
> statistics module for Python 3.4. At the moment, I have extensive
> docstrings in the module itself. I don't believe anyone has flagged that
> as "too much information" in a code review, so I'm going to assume that
> large docstrings will be acceptable.
>
> However, I have been asked to ensure that there is a separate
> statistics.rst file for documentation.
>
> I don't want to have to maintain the documentation in two places, both
> in the .py module and in .rst file. Can anyone give me some pointers as
> to best practice in this situation? Is there a "How To Write Docs For
> The Standard Library" document somewhere? Perhaps I missed it, but my
> searches found nothing useful. I have read this:
>
> http://docs.python.org/devguide/documenting.html
>
> but it didn't shed any light on my situation.
>

IMHO the right way to think about it is that the .rst files are by far the
more important documentation. Sometimes we forget that most Python
programmers are people who won't go into the source to read docstrings.
Moreover, the nice web layout, table of contents, index, and link-ability
of .rst is very important - I also prefer to read it as opposed to going
through docstrings. I only go to docstrings/code when I didn't find
something in the .rst docs, at this point also usually opening a bug to fix
that.

So whatever you do for statistics, full .rst docs must be there. It's the
docstrings that are "optional" here. The best solution may be auto
generating, for sure. But a module without .rst documented is unacceptable.

Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130922/8d9cbea9/attachment.html>


More information about the Python-Dev mailing list