Message375707
In fact, what happens in the latter case (i.e. `"--a 1 --b 2"`), inside the call to `_parse_optional`, is that it fails to get the optional tuple. And so it continues to this line in argparse.py:
https://github.com/python/cpython/blob/2ce39631f679e14132a54dc90ce764259d26e166/Lib/argparse.py#L2227
Here it says that if there's a space in the string, it was meant to be a positional, and so the function returns `None`, causing it to not find the argument.
In conclusion, it seems to me that argparse is not, in fact, meant to handle quoted strings, or rather, strings where there are spaces. |
|
Date |
User |
Action |
Args |
2020-08-20 12:00:44 | vegarsti | set | recipients:
+ vegarsti |
2020-08-20 12:00:44 | vegarsti | set | messageid: <1597924844.66.0.620020425851.issue41600@roundup.psfhosted.org> |
2020-08-20 12:00:44 | vegarsti | link | issue41600 messages |
2020-08-20 12:00:44 | vegarsti | create | |
|