homepage

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 svenevs
Recipients benhoyt, charlie.proctor, paul.j3, rrt, svenevs
Date 2019年05月27日.11:14:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1558955654.89.0.502593267799.issue28609@roundup.psfhosted.org>
In-reply-to
Content
> For optionals, `required` is set by the programmer. But for positionals it is set with: ...
> So for '?' argument, required is False. But for '*', it must also have a 'default' parameter (not just the default None).
> So the proposed patch is overriding the 'required' value that was set during 'add_argument'. And issuing this error message is the main purpose of the 'required' attribute.
nargs='*' being marked as `required` is incorrect though, isn't it?
I was also very confused by this behavior, the only reason I found this bug was to search before opening new, and had a patch prepared that is nearly identical to the one here.
1. It's really helpful to know about explicitly setting `default=None|[]` depending on use case. Would a docs PR briefly explaining at the bottom of the nargs [a] docs explaining how to change the error message via `default` be welcome? This is a slightly challenging problem to search for.
2. My understanding is the ultimate rejection of the patch is because it's bypassing the `required` attribute. So to fix this adequately, changing ? and * to not show up as required (when no `default` provided) should be done?
[a] https://docs.python.org/3/library/argparse.html#nargs 
History
Date User Action Args
2019年05月27日 11:14:14svenevssetrecipients: + svenevs, benhoyt, paul.j3, charlie.proctor, rrt
2019年05月27日 11:14:14svenevssetmessageid: <1558955654.89.0.502593267799.issue28609@roundup.psfhosted.org>
2019年05月27日 11:14:14svenevslinkissue28609 messages
2019年05月27日 11:14:14svenevscreate

AltStyle によって変換されたページ (->オリジナル) /