Nick Coghlan <ncoghlan@gmail.com> writes:
I would be a lot happier if argparse as a standard library module just followed optparse's lead here (i.e. defined '--version' only and punted on the shorthand form).
To deal with this in a backwards compatible way while remaining on the path to more conventional behaviour, I suggest the following:
1. For Python 2.7, deprecate *just* the "-v" default behaviour for the version. This means "--version" and "-v" will be set to invoke different actions when the version argument is supplied (the latter will trigger a deprecation warning if supplied, while the former will work normally).
2. For Python 3.2, don't create the "-v" shorthand at all (i.e. only create "--version").
+1 As someone who uses the existing ‘optparse’ behaviour to implement a number of Unix command-line programs, the above all makes more sense for ‘argparse’ in the standard library if we're expecting it to be a smooth upgrade. -- \ “Natural catastrophes are rare, but they come often enough. We | `\ need not force the hand of nature.” —Carl Sagan, _Cosmos_, 1980 | _o__) | Ben Finney