Message400968
> 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']) |
|
Date |
User |
Action |
Args |
2021-09-02 23:28:01 | rhettinger | set | recipients:
+ rhettinger, terry.reedy, paul.j3, Thermi, joker, wodny85 |
2021-09-02 23:28:01 | rhettinger | set | messageid: <1630625281.7.0.428883024348.issue44748@roundup.psfhosted.org> |
2021-09-02 23:28:01 | rhettinger | link | issue44748 messages |
2021-09-02 23:28:01 | rhettinger | create | |
|