Message288445
The possible values for action are currently:
'store'
'store_true'
'store_false'
'store_const'
'append'
'append_const'
'count'
'help'
'version'
a subclass of argparse.Action
The string values are evidently for backward compatibility with optparse. However, adding the ability to specify these options as flags would make argparse code more maintainable (e.g. IDEs are better at refactoring symbols than strings), bring it in line with other places where a module has built-in flags, like the regex module (re.MULTILINE, re.IGNORECASE, etc.), and expand the use of flags that already exist in argparse (e.g. argparse.SUPPRESS, argparse.REMAINDER).
The string values need not be immediately deprecated, but can be made available as the preferred option for new development. See, for example, getName() and setName() in the threading module, which are documented as follows: "Old getter/setter API for name; use it directly as a property instead." A similar suggestion can be provided for argparse flags: "Old action values for backward compatibility; use the flags instead." |
|
Date |
User |
Action |
Args |
2017-02-23 13:31:07 | pgacv2 | set | recipients:
+ pgacv2 |
2017-02-23 13:31:07 | pgacv2 | set | messageid: <1487856667.94.0.619514979386.issue29632@psf.upfronthosting.co.za> |
2017-02-23 13:31:07 | pgacv2 | link | issue29632 messages |
2017-02-23 13:31:07 | pgacv2 | create | |
|