Message245473
You can give the positional any custom name (the first parameter). You just can't reuse it (by giving 2 positionals the same name). And if you don't like what the 'help' shows, you can set the 'metavar'. That way only you see the positional's name.
The name of a positional can be the 'dest' of an optional. But wouldn't that be confusing? Setting the same attribute with a required postional and one or more optional optionals?
'nargs' is another way of assigning more than one value to a Namespace attribute. You just can't put an optional between two such values.
`argparse` is a parser, a way of identifying what the user gives you. It is better to err on the side of preserving information. Different argument dests does that. You can always combine values after parsing.
args.foo.append(args.bar) # or .extend()
args.x = [args.foo, args.bar]
Don't try to force argparse to do something special when you can just as easily do that later with normal Python expressions. |
|
Date |
User |
Action |
Args |
2015-06-18 17:01:51 | paul.j3 | set | recipients:
+ paul.j3, py.user |
2015-06-18 17:01:51 | paul.j3 | set | messageid: <1434646911.84.0.0718676183668.issue24419@psf.upfronthosting.co.za> |
2015-06-18 17:01:51 | paul.j3 | link | issue24419 messages |
2015-06-18 17:01:51 | paul.j3 | create | |
|