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 <>
> 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?

Date User Action Args
2019-05-27 11:14:14svenevssetrecipients: + svenevs, benhoyt, paul.j3, charlie.proctor, rrt
2019-05-27 11:14:14svenevssetmessageid: <>
2019-05-27 11:14:14svenevslinkissue28609 messages
2019-05-27 11:14:14svenevscreate