@@ -690,9 +690,9 @@ how the command-line arguments should be handled. The supplied actions are:
690690
691691* ``'append' `` - This appends each argument value to a list.
692692 It is useful for allowing an option to be specified multiple times.
693- If the default value is a non-empty list, the parsed value will start
694- with the default list's elements and any values from the command line
695- will be appended after those default values. Example usage::
693+ If the default value is a non-empty list, the parsed value for the option
694+ will start with the default list's elements and any values from the
695+ command line will be appended after those default values. Example usage::
696696
697697 >>> parser = argparse.ArgumentParser()
698698 >>> parser.add_argument('--foo', action='append', default=['0'])
@@ -717,12 +717,16 @@ how the command-line arguments should be handled. The supplied actions are:
717717 value ``'+' `` or ``'*' ``.
718718 Note that when nargs _ is ``None `` (the default) or ``'?' ``, each
719719 character of the argument string will be appended to the list.
720+ If the default value is a non-empty list, the parsed value for the option
721+ will start with the default list's elements and any values from the
722+ command line will be appended after those default values.
720723 Example usage::
721724
722725 >>> parser = argparse.ArgumentParser()
723- >>> parser.add_argument("--foo", action="extend", nargs="+", type=str)
726+ >>> parser.add_argument("--foo", action="extend", nargs="+", type=str,
727+ ... default=["d1"])
724728 >>> parser.parse_args(["--foo", "f1", "--foo", "f2", "f3", "f4"])
725- Namespace(foo=['f1', 'f2', 'f3', 'f4'])
729+ Namespace(foo=['d1', ' f1', 'f2', 'f3', 'f4'])
726730
727731 .. versionadded :: 3.8
728732
0 commit comments