File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1165,6 +1165,17 @@ must specify for any option using that action.
11651165
11661166 options.tracks.append(int("4"))
11671167
1168+ The ``append `` action calls the ``append `` method on the current value of the
1169+ option. This means that any default value specified must have an ``append ``
1170+ method. It also means that if the default value is non-empty, the default
1171+ elements will be present in the parsed value for the option, with any values
1172+ from the command line appended after those default values::
1173+
1174+ >>> parser.add_option("--files", action="append", default=['~/.mypkg/defaults'])
1175+ >>> opts, args = parser.parse_args(['--files', 'overrides.mypkg'])
1176+ >>> opts.files
1177+ ['~/.mypkg/defaults', 'overrides.mypkg']
1178+
11681179* ``"append_const" `` [required: :attr: `~Option.const `; relevant:
11691180 :attr: `~Option.dest `]
11701181
You can’t perform that action at this time.
0 commit comments