This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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:54r.david.murraysetrecipients: + r.david.murray, bethard, chris.jerdonek
2013-01-07 00:51:54r.david.murraysetmessageid: <1357519914.21.0.754775350458.issue16878@psf.upfronthosting.co.za>
2013-01-07 00:51:54r.david.murraylinkissue16878 messages
2013-01-07 00:51:53r.david.murraycreate