[issue21805] Argparse Revert config_file defaults

R. David Murray report at bugs.python.org
Thu Jun 19 15:58:34 CEST 2014


R. David Murray added the comment:

I don't understand your use case.  As a user I would expect a switch to either set the value to true or to false, not to toggle it based on some default that might be changed in a configuration file.

But, your method of accomplishing your goal looks fine to me, except that it is unnecessarily verbose.  You can just write:
  
   const=not config_defaults['verbose']

You might also want to make the help text conditional, so that the user knows whether the switch is going to turn verbosity on or off.

You *could* write your own store_opposite action routine, but that seems like overkill, especially if you decide to also make the help text conditional.

Given how simple this is to do, I'm rejecting the feature request.

----------
nosy: +r.david.murray
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21805>
_______________________________________


More information about the Python-bugs-list mailing list