@@ -442,9 +442,8 @@ is considered equivalent to the expression ``['-f', 'foo', '-f', 'bar']``.
442442
443443.. note ::
444444
445- Empty lines are treated as empty strings (``'' ``), which are allowed as values but
446- not as arguments. Empty lines that are read as arguments will result in an
447- "unrecognized arguments" error.
445+ Each line is treated as a single argument, so an empty line is read as an
446+ empty string (``'' ``).
448447
449448:class: `ArgumentParser ` uses :term: `filesystem encoding and error handler `
450449to read the file containing arguments.
@@ -1052,6 +1051,10 @@ is used when no command-line argument was present::
10521051 >>> parser.parse_args([])
10531052 Namespace(foo=42)
10541053
1054+ Because ``nargs='*' `` gathers any supplied values into a list, an absent
1055+ positional argument yields an empty list (``[] ``). Only a non-``None ``
1056+ *default * overrides this (so ``default=None `` still gives ``[] ``).
1057+
10551058For required _ arguments, the ``default `` value is ignored. For example, this
10561059applies to positional arguments with nargs _ values other than ``? `` or ``* ``,
10571060or optional arguments marked as ``required=True ``.
@@ -1369,6 +1372,11 @@ behavior::
13691372 >>> parser.parse_args('--foo XXX'.split())
13701373 Namespace(bar='XXX')
13711374
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+
13721380.. versionchanged :: 3.15
13731381 Single-dash long option now takes precedence over short options.
13741382
@@ -1777,6 +1785,11 @@ Subcommands
17771785 present, and when the ``b `` command is specified, only the ``foo `` and
17781786 ``baz `` attributes are present.
17791787
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+
17801793 Similarly, when a help message is requested from a subparser, only the help
17811794 for that particular parser will be printed. The help message will not
17821795 include parent parser or sibling parser messages. (A help message for each
@@ -2232,6 +2245,9 @@ Customizing file parsing
22322245 def convert_arg_line_to_args(self, arg_line):
22332246 return arg_line.split()
22342247
2248+ Note that with this override an argument can no longer contain spaces, since
2249+ each space-separated word becomes a separate argument.
2250+
22352251
22362252Exiting methods
22372253^^^^^^^^^^^^^^^
0 commit comments