What should Python apps do when asked to show help?

John Wong gokoproject at gmail.com
Thu Apr 28 13:05:51 EDT 2016


On Thu, Apr 28, 2016 at 1:02 PM, Dan Strohl via Python-list <
python-list at python.org> wrote:

> I would suggest using argparse
> https://docs.python.org/3/library/argparse.html as it handles all of that
> natively... including validating arguments, showing errors, help, etc...
> however, assuming you don't want to;
>
> Totally agree with this approach. Command line should stick with argparse.
Personally I'd stick with argparse and not other open source projects which
is built on argparse (or optparse, the one you don't want to use, but eh
some people decided to do that anyway because of some limitations in
argparse).

In fact you shouldn't need to implement -h/--help when you use argparse. If
a user is going to use the command line, you can almost always assume the
user can use -h/--help, or for those familiar with Linux just provide a man
page.

After all, what you need is a very clear documentation upfront prior to the
installation so your users can refer to that for ultimate help.



More information about the Python-list mailing list