feedback on function introspection in argparse
ubershmekel at gmail.com
Sun Nov 8 00:44:33 CET 2009
On Nov 8, 1:33 am, Carl Banks <pavlovevide... at gmail.com> wrote:
> Is the docstring expected to be formatted according to some
Yes it does, we parse the docstring as explained in argparse.py:
"""Parses a function's docstring for a description of the function
help on the individual parameters.
The parsing algorithm currently looks for lines that start with a
name immediately followed by any amount of whitespace, hyphens or
The rest of the line following the colon/hyphen/whitespace is the
function - the function whose docstring is parsed.
Returns a (description, help_dict) tuple:
description - all text before the first documented parameter
help_dict - a dictionary mapping parameter names to their help
We tried to comply to PEP 257 and we're open to suggestions on this.
More information about the Python-list