[Python-Dev] Python 2.7b1 and argparse's version action

Tobias Herp Tobias.Herp at gmx.de
Sun Apr 18 23:48:55 CEST 2010


Steven Bethard schrieb:
> On Sun, Apr 18, 2010 at 4:03 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>> 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).
> 
> [...]
> 
> All I can imagine you mean is to issue a deprecation warning whenever
> a user of the script provides "-v" at the command line, but that seems
> sketchy to me - we'd be deprecating features of someone's
> *application*, not features of the argparse *library*.

It would raise warnings when the option is /used/ (rather than defined;
such warnings address programmers, though), and it wouldn't free '-v'
for other uses.

I agree that this would be more complicated than necessary.
It would be better to just drop the default usage of '-v'.
This way we wouldn't need a deprecation procedure either.

-- 
Tobias


More information about the Python-Dev mailing list