module attributes and docstrings

Mario Figueiredo marfig at gmail.com
Tue Mar 24 04:55:30 EDT 2015


Reading PEP 257 and 258 I got the impression that I could document
module attributes and these would be available in the __doc__
attribute of the object.

So things like the one below are something I got used to do, but that
don't work after all, as I learned today:

    value_factory = lambda _, row: row[0]
    """Row factory. To be used with single-column queries."""

There are other things I could possibly do, like turning that lambda
into a function, or document attributes in the module docstring. They
are fair responses.

But did I read docstring extraction rules in PEP 258 wrong by assuming
that the above example would make into the __doc__ attribute? And if
so, short of documenting attributes in the module docstring, is there
another way I can document individual attributes?



More information about the Python-list mailing list