Message179237
>>> p.add_argument('-a', action="append", default=None)
>>> p.parse_args([])
Namespace(a=None)
>>> p.parse_args(['-a', '1', '-a', '2'])
Namespace(a=['1', '2'])
So there's a logical correspondence there (repeated option vs multiple values, each producing a list).
I'm not sure what you mean by the difference between options and positionals. I note that you can use nargs with an optional, and in that case the default works, which is even more unfortunate than the difference with 'append'. But if you can articulate a logical difference between optionals and positional here, maybe we can make it look reasonable :) |
|
Date |
User |
Action |
Args |
2013-01-07 00:51:54 | r.david.murray | set | recipients:
+ r.david.murray, bethard, chris.jerdonek |
2013-01-07 00:51:54 | r.david.murray | set | messageid: <1357519914.21.0.754775350458.issue16878@psf.upfronthosting.co.za> |
2013-01-07 00:51:54 | r.david.murray | link | issue16878 messages |
2013-01-07 00:51:53 | r.david.murray | create | |
|