@@ -787,9 +787,9 @@ how the command-line arguments should be handled. The supplied actions are:
787787
788788* ``'append' `` - This appends each argument value to a list.
789789 It is useful for allowing an option to be specified multiple times.
790- If the default value is a non-empty list, the parsed value will start
791- with the default list's elements and any values from the command line
792- will be appended after those default values. Example usage::
790+ If the default value is a non-empty list, the parsed value for the option
791+ will start with the default list's elements and any values from the
792+ command line will be appended after those default values. Example usage::
793793
794794 >>> parser = argparse.ArgumentParser()
795795 >>> parser.add_argument('--foo', action='append', default=['0'])
@@ -814,12 +814,16 @@ how the command-line arguments should be handled. The supplied actions are:
814814 value ``'+' `` or ``'*' ``.
815815 Note that when nargs _ is ``None `` (the default) or ``'?' ``, each
816816 character of the argument string will be appended to the list.
817+ If the default value is a non-empty list, the parsed value for the option
818+ will start with the default list's elements and any values from the
819+ command line will be appended after those default values.
817820 Example usage::
818821
819822 >>> parser = argparse.ArgumentParser()
820- >>> parser.add_argument("--foo", action="extend", nargs="+", type=str)
823+ >>> parser.add_argument("--foo", action="extend", nargs="+", type=str,
824+ ... default=["d1"])
821825 >>> parser.parse_args(["--foo", "f1", "--foo", "f2", "f3", "f4"])
822- Namespace(foo=['f1', 'f2', 'f3', 'f4'])
826+ Namespace(foo=['d1', ' f1', 'f2', 'f3', 'f4'])
823827
824828 .. versionadded :: 3.8
825829
0 commit comments