10000 GH-87358: Add clarification about nargs and default argparse behaviour by savannahostrowski · Pull Request #124094 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-87358: Add clarification about nargs and default argparse behaviour #124094

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

Merged
merged 5 commits into from
Sep 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
appease linter
  • Loading branch information
savannahostrowski committed Sep 22, 2024
commit 3bfd5ad0c428df48f5fe3d411b23152ddd1bfe8e
4 changes: 2 additions & 2 deletions Doc/library/argparse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1122,8 +1122,8 @@ is used when no command-line argument was present::
>>> parser.parse_args([])
Namespace(foo=42)

For required_ arguments, the ``default`` value is ignored. For example, this
applies to positional arguments with nargs_ values other than ``?`` or ``*``,
For required_ arguments, the ``default`` value is ignored. For example, this
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside: we have a (somewhat unusual) convention of using italics for arguments instead of literal code formatting:

https://devguide.python.org/documentation/markup/

But I see we're using literals elsewhere in this file so it's best to be consistent.

applies to positional arguments with nargs_ values other than ``?`` or ``*``,
or optional arguments marked as ``required=True``.

Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if the
Expand Down
Loading
0