[Python-Dev] Python 2.7b1 and argparse's version action
Ben Finney
ben+python at benfinney.id.au
Sun Apr 18 15:16:55 CEST 2010
Nick Coghlan <ncoghlan at 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
More information about the Python-Dev
mailing list