[Python-Dev] bug or feature? fixing argparse's default help value for version actions

Brett Cannon brett at python.org
Thu May 20 18:56:29 CEST 2010


On Thu, May 20, 2010 at 09:18, Steven Bethard <steven.bethard at gmail.com> wrote:
> Sorry I haven't had time to get around to the argparse issues. I
> should have time this weekend. I need a release manager call on one of
> the issues though. Two things I assume are fine to fix at this stage:
>
> * In the documentation, the '--version' example should either not use
> a shorthand, or should use the conventional '-V'
> * In the documentation, the difference between the argparse and
> optparse ways of specifying versions needs to be mentioned in the
> section on migrating from optparse.
>
> One thing I'm not sure about:
>
> * Right now, the default help value for the version action is None,
> which is pretty useless since it means that everyone has to type in
> the same help="show program's version number and exit" when they use
> the version action. Instead, the string "show program's version number
> and exit" should have been the default value for the help argument. To
> be explicit, right now everyone who adds a version to their argument
> parser has to write:
>
>  parser.add_argument('-V', action='version', version='<the version>',
> help="show program's version number and exit")
>
> With the fixed default value you would only have to write:
>
>  parser.add_argument('-V', action='version', version='<the version>')
>
> Can this be considered a bug, i.e. something that can be committed
> before the RC? Or does it need to be considered a feature, i.e. at
> this point can never be added to Python 2.7?

In the end it's Benjamin's call, but my vote is to make the change.
The chances someone wanted None as their help message is so bloody
small and this is such a good UX change that I'm +1 on making the
change.

-Brett


More information about the Python-Dev mailing list