[Python-Dev] Python 2.7b1 and argparse's version action (original) (raw)

Tobias Herp Tobias.Herp at gmx.de
Mon Apr 19 02:07:35 CEST 2010


Eric Smith schrieb:

Steven Bethard wrote:

By the way, we could simplify the typical addargument usage by adding "show program's version number and exit" as the default help for the 'version' action. Then you should just write:

parser.addargument('--version', action='version', version='') I like this the best. I don't like argparse adding arguments for me.

There is no reason why you shouldn't get it. You could always (and with optparse as well as argparse) omit the version argument and build or build not the version argument yourself.

Or a special add_version_option (hey, it's really an /option/) or add_version_argument method, which would work without if statements and could be overridden in subclasses.

But note that

-- Tobias



More information about the Python-Dev mailing list