Equivalent of perl's Pod::Usage?

Adam Funk a24061 at ducksburg.com
Thu Dec 13 16:57:28 EST 2007


On 2007-12-10, Nick Craig-Wood wrote:

> That said, python does a good job of turning doc strings and class
> descriptions into man pages even without any special markup, if you
> wrote docstrings everywhere.  Try pydoc on any bit of python (without
> the .py) and you'll see what I mean
>
> As for Pod::Usage - write the instructions for your script as a
> docstring at the top of your file, then use this little function...
>
> def usage(error):
>     """
>     Print the usage, an error message, then exit with an error
>     """
>     print >>sys.stderr, globals()['__doc__']
>     print >>sys.stderr, error
>     sys.exit(1)

That looks useful; thanks.



More information about the Python-list mailing list