Message356939
At this moment it's impossible to explain the behaviour of this script using documentation.
Given it was explicitly coded to behave like that - it should be somehow noted in the documentation, that as long as a `CliArgs.foo` field has a default value set already - it won't be overwritten with a default argparse argument value.
```
import argparse
class CliArgs(object):
foo: str = 'not touched'
parser = argparse.ArgumentParser()
parser.add_argument('--foo', default='bar')
args = CliArgs()
parser.parse_args(namespace=args)
print(args.foo) # 'not touched'
print(parser.parse_args()) # 'bar'
``` |
|
Date |
User |
Action |
Args |
2019-11-19 02:23:43 | zerkms | set | recipients:
+ zerkms, docs@python |
2019-11-19 02:23:43 | zerkms | set | messageid: <1574130223.67.0.390215742489.issue38843@roundup.psfhosted.org> |
2019-11-19 02:23:43 | zerkms | link | issue38843 messages |
2019-11-19 02:23:43 | zerkms | create | |
|