8000 GH-108009: Add clarification of parser and argument defaults in argparse docs by savannahostrowski · Pull Request #124154 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-108009: Add clarification of parser and argument defaults in argparse docs #124154

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
appease linter
  • Loading branch information
savannahostrowski committed Sep 17, 2024
commit 2232b8d1bbce88752a908b4c0a18df9aa58b921a
4 changes: 2 additions & 2 deletions Doc/library/argparse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2123,9 +2123,9 @@ Parser defaults
>>> parser.parse_args(['736'])
Namespace(bar=42, baz='badger', foo=736)

Note that defaults can be set at both the parser level using :meth:`set_defaults`
Note that defaults can be set at both the parser level using :meth:`set_defaults`
and at the argument level using :meth:`add_argument`. If both are provided for the
same argument, the order of setting these defaults determines which one takes
same argument, the order of setting these defaults determines which one takes
precedence. The last default set for an argument is the one that is used:

>>> parser = argparse.ArgumentParser()
Expand Down
Loading
0