File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1372,6 +1372,11 @@ behavior::
13721372 >>> parser.parse_args('--foo XXX'.split())
13731373 Namespace(bar='XXX')
13741374
1375+ Multiple arguments may share the same ``dest ``. By default, the value from the
1376+ last such argument given on the command line wins. Use ``action='append' `` to
1377+ collect values from all of them into a list instead. For conflicting *option
1378+ strings * rather than ``dest `` names, see conflict_handler _.
1379+
13751380.. versionchanged :: 3.15
13761381 Single-dash long option now takes precedence over short options.
13771382
@@ -1780,6 +1785,11 @@ Subcommands
17801785 present, and when the ``b `` command is specified, only the ``foo `` and
17811786 ``baz `` attributes are present.
17821787
1788+ If a subparser defines an argument with the same ``dest `` as the parent
1789+ parser, the two share a single namespace attribute, so the parent's value
1790+ won't be retained. Users should give them distinct ``dest `` values to
1791+ keep both.
1792+
17831793 Similarly, when a help message is requested from a subparser, only the help
17841794 for that particular parser will be printed. The help message will not
17851795 include parent parser or sibling parser messages. (A help message for each
You can’t perform that action at this time.
0 commit comments