python / python/cpython

argparse: undocumented `nargs` constants `ONE_OR_MORE`, `OPTIONAL`, `PARSER`, `REMAINDER`, `ZERO_OR_MORE`, `SUPPRESS`

Open
#118,920 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Concerning the possible values of the nargs parameter of add_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 for help parameter in https://github.com/python/cpython/issues/53595, but not for nargs.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the argparse documentation for ArgumentParser.add_argument() and its nargs parameter, then check how the existing help parameter documentation describes SUPPRESS. Document the nargs constants listed in the issue, including the values for OPTIONAL, ZERO_OR_MORE, and ONE_OR_MORE and the missing PARSER and REMAINDER descriptions; done when all listed constants are covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.