Vegard Stikbakke <vegard.stikba...@gmail.com> added the comment:

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.

----------

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

Reply via email to