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

Steven Bethard steven.bethard at gmail.com
Mon Apr 19 00:46:00 CEST 2010


On Sun, Apr 18, 2010 at 2:35 PM, Tobias Herp <Tobias.Herp at gmx.de> wrote:

Steven Bethard schrieb:

On Sun, Apr 18, 2010 at 3:31 AM, Tobias Herp <Tobias.Herp at gmx.de> wrote:

Argparse should simply do this like optparse does already. I.e., use '--version', '--help' and '-h' by default, but not '-v'. [snip] The deprecation of the 'version' argument press-gangs people to replace it by  parser.addargument('--version', action='version',  version='',    # the only common part  help="show program's version number and exit")

What Tobias has conveniently omitted is that there was not much agreement on what the default behavior of the version flag should be. [snip a bunch of Tobias's opinions on what the default should be] But I'd really like a consensus about the correct behavior, and so far I have not seen that. We'll have one ;-)

I hope you can understand that I don't consider your personal opinion alone as a consensus. As I said, I'm willing to change the defaults and even break backwards compatibility a bit in Python trunk[1] but I need to a see a consensus from a variety of developers that "--version" is the right answer, and not "-V/--version", etc. Note that even though I agree with you that "-v/--version" is probably not the best choice, in the poll[2] 11% of people still wanted this. So it's not a simple decision.

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

parser.add_argument('--version', action='version', version='<the version>')

Steve

[1] Assuming the release manager will allow it. [2] http://www.vizu.com/res/Grab-bag/argparse/poll-results.html?n=192933

Where did you get that preposterous hypothesis? Did Steve tell you that? --- The Hiphopopotamus



More information about the Python-Dev mailing list