Message227193
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. |
|
Date |
User |
Action |
Args |
2014-09-20 22:58:18 | paul.j3 | set | recipients:
+ paul.j3, bethard, DenKoren |
2014-09-20 22:58:18 | paul.j3 | set | messageid: <1411253898.52.0.113275383247.issue22433@psf.upfronthosting.co.za> |
2014-09-20 22:58:18 | paul.j3 | link | issue22433 messages |
2014-09-20 22:58:18 | paul.j3 | create | |
|