paul j3 added the comment:

Your patch fails:

    python3 -m unittest test_argparse.TestEmptyAndSpaceContainingArguments

specifically these 2 subcases:

       (['-a badger'], NS(x='-a badger', y=None)),
       (['-y', '-a badger'], NS(x=None, y='-a badger')),

--------------------

At issue is the ambiguity when the user gives you a string that looks like an 
optionals flag, but doesn't match one of the defined arguments.  When should it 
be treated as a positional, and when should it be treated as an unknown?

The code, and test says - if it has the space, treat it like a positional.  You 
are trying to reverse that choice - if it has the prefix, treat it like an 
unknown optional.  At the point where you apply the patch, we already know that 
the string has a prefixchar.  So you are, effectively, eliminating the 'space' 
test.

I've added a simpler example of where the presence of the space flips that 
choice.

----------
nosy: +paul.j3
Added file: http://bugs.python.org/file36672/example.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22433>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to