Skip to content

Commit 5f7766c

Browse files
committed
gh-110131: Restore the "for the option" scope in argparse's append docs
Before GH-131389 the bullet read "the default elements will be present in the parsed value for the option". That copyedit rewrote the sentence and added an example, and the qualifier went with it, which left the bullet claiming something that does not hold for positionals: append with nargs='*' or '?' and default=['X'] gives ['X', ['X']] on empty input, because the default is applied twice. gh-110131 is filed against both 'append' and 'extend', so put the scope back rather than leave the two bullets disagreeing about it.
1 parent 94bd220 commit 5f7766c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎Doc/library/argparse.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -791,9 +791,9 @@ how the command-line arguments should be handled. The supplied actions are:
791791

792792
* ``'append'`` - This appends each argument value to a list.
793793
It is useful for allowing an option to be specified multiple times.
794-
If the default value is a non-empty list, the parsed value will start
795-
with the default list's elements and any values from the command line
796-
will be appended after those default values. Example usage::
794+
If the default value is a non-empty list, the parsed value for the option
795+
will start with the default list's elements and any values from the
796+
command line will be appended after those default values. Example usage::
797797

798798
>>> parser = argparse.ArgumentParser()
799799
>>> parser.add_argument('--foo', action='append', default=['0'])

0 commit comments

Comments
 (0)