diff options
Diffstat (limited to 'Lib/argparse.py')
-rw-r--r-- | Lib/argparse.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/argparse.py b/Lib/argparse.py index 25803b3..0ee8c08 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -2186,9 +2186,12 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): # Value conversion methods # ======================== def _get_values(self, action, arg_strings): - # for everything but PARSER args, strip out '--' + # for everything but PARSER, REMAINDER args, strip out first '--' if action.nargs not in [PARSER, REMAINDER]: - arg_strings = [s for s in arg_strings if s != '--'] + try: + arg_strings.remove('--') + except ValueError: + pass # optional argument produces a default when not present if not arg_strings and action.nargs == OPTIONAL: |