summaryrefslogtreecommitdiff
path: root/argparse.py
diff options
context:
space:
mode:
authorsteven.bethard <devnull@localhost>2009-07-26 15:16:18 +0000
committersteven.bethard <devnull@localhost>2009-07-26 15:16:18 +0000
commitcffc1b330eb2293efba0b57bb0a3b56080283c75 (patch)
treee3b7ed63cb029324d5288676e0e5e3bf599c50c7 /argparse.py
parent25d79f58974cc14f475a4762926981e247c9f70c (diff)
downloadargparse-cffc1b330eb2293efba0b57bb0a3b56080283c75.tar.gz
Spaces now only signal a positional if the argument string doesn't start with an optional declared in the parser.
Diffstat (limited to 'argparse.py')
-rw-r--r--argparse.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/argparse.py b/argparse.py
index bf3f277..05dbffb 100644
--- a/argparse.py
+++ b/argparse.py
@@ -1937,10 +1937,6 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
if not arg_string:
return None
- # if it contains a space, it was meant to be a positional
- if ' ' in arg_string:
- return None
-
# if it doesn't start with a prefix, it was meant to be positional
if not arg_string[0] in self.prefix_chars:
return None
@@ -1978,6 +1974,10 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
if not self._has_negative_number_optionals:
return None
+ # if it contains a space, it was meant to be a positional
+ if ' ' in arg_string:
+ return None
+
# it was meant to be an optional but there is no such option
# in this parser (though it might be a valid option in a subparser)
return None, arg_string, None