-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
argparse: undocumented nargs
constants ONE_OR_MORE
, OPTIONAL
, PARSER
, REMAINDER
, ZERO_OR_MORE
, SUPPRESS
#118920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
nargs
constants ONE_OR_MORE
, OPTIONAL
, PARSER
, REMAINDER
, ZERO_OR_MORE
nargs
constants ONE_OR_MORE
, OPTIONAL
, PARSER
, REMAINDER
, ZERO_OR_MORE
, SUPPRESS
I'm not really convinced that we should do this. While we could document these constants for completeness, doing so would probably add unnecessary redundancy to the docs and potentially confuse newer users. Using *, +, ?, etc. is far and away more common than using these constants A cursory search on GitHub also showed very little usage for PARSER and SUPPRESS. To the best of my knowledge, unlike REMAINDER, these were never documented. |
Thank you for your input @savannahostrowski. However, the argument based on search frequency may reflect a statistical bias. The low usage of these constants could be a direct result of their lack of documentation, rather than an indication of their irrelevance or redundancy. Proper documentation could potentially increase their usage, especially in scenarios where constants are preferred for clarity or consistency (e.g., linters, editors/autocomplete). Therefore, documenting these constants would enhance completeness and potentially benefit users who prefer or require explicit constants. |
Concerning the possible values of the
nargs
parameter ofadd_argument()
.The following values are already described in the documentation, so only a mention of the constants is needed:
OPTIONAL
=?
ZERO_OR_MORE
=*
ONE_OR_MORE
=+
The following constants and their values do not seem to be documented anywhere:
PARSER
REMAINDER
SUPPRESS
constant was documented forhelp
parameter in #53595, but not fornargs
.The text was updated successfully, but these errors were encountered: