Argparse is not just about parsing, it's about providing convenient
tooling associated with parsing.
Otherwise you would not have automatically generated a "usage" message
or a "--help" command.
Following your definition, those are not parsing. But there are here,
because we all end up coding them anyway.
Le 09/08/2017 à 11:50, Ned Batchelder a écrit :
> On 8/9/17 3:56 AM, Tarek Ziadé wrote:
>> I don't think there's any helper to deprecate an argument in argparse
>> Let's say you have a --foo option in your CLI and want to deprecate it
>> in the next release before you completely remove it later.
>> My first though on how to do this by adding a new "deprecated" option to
>> "deprecated" would be a callable that is called after the argument has
>> been parsed by argparse,
>> so the developer can decide if they want to issue a deprecation warning,
>> use the parsed value or override it etc.
> I don't see why this is something that argparse has to do. The
> semantics of options is handled by the rest of the program. Why would
> the parser be issuing these warnings? Let argparse parse the options,
> then let other code deal with what they *mean*.
> Python-ideas mailing list
> Code of Conduct: http://python.org/psf/codeofconduct/
Python-ideas mailing list
Code of Conduct: http://python.org/psf/codeofconduct/