Message179237
| Author |
r.david.murray |
| Recipients |
bethard, chris.jerdonek, r.david.murray |
| Date |
2013年01月07日.00:51:53 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1357519914.21.0.754775350458.issue16878@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
>>> 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 :) |
|
History
|
|---|
| 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 |
|