Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

> then you can't show the defaults in the help message.

1) The --help option doesn't normally show defaults.

2) Why would you show defaults in help, if you're going to ignore them in favor 
the values in config whenever they aren't specified.  If ignored or overridden, 
they aren't actually default values.

3) Why not dynamically configure the argparse default values with data from 
config?

config = {'w': 5, 'x': 10, 'y': False, 'z': True}

p = ArgumentParser()
p.add_argument('-x', type=int, default=config['x'])
p.add_argument('-y', action='store_true', default=config['y'])
ns = p.parse_args(['-h'])

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44748>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to