You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
argparse fails to get value of argument if the value is -- #109475
$ podman run -v $(pwd):/src python:3.11.5-bookworm python /src/delim.py
Namespace(broken=[], working='asdf')
The value of the --broken argument is not parsed, presumably because it is the standard end-of-argument-list value. But this does not seem expected when the value is introduced with =. Besides, in this case, the parsing does continue for subsequent args, so it was not actually treated as end of arguments.
-- means a very specific thing in argument parsing, I don't think that it should be a value of any other argument. If you need this value somewhere in your program, you can use some alias: like --flag=doubledash
-- means a very specific thing in argument parsing, I don't think that it should be a value of any other argument. If you need this value somewhere in your program, you can use some alias: like --flag=doubledash
I completely disagree with this. Imagine if you were reading the documentation of a command line utility, and it said "If you want the output file to be named '--', then use 'doubledash' instead, and this will be translated to '--' internally. It is not possible to specify an output name of 'doubledash'."
I think this is a completely valid bug report. I'm not sure it's fixable, given all of the issues with argparse and how it scans arguments. I am surprised that using =-- doesn't work. See #53580 for a case where using = was suggested as a partial workaround.
Reacted by Petr Viktorin, Daniel Colascione and Serhiy Storchaka
Activity
sobolevn commentedon Sep 16, 2023
--means a very specific thing in argument parsing, I don't think that it should be a value of any other argument. If you need this value somewhere in your program, you can use some alias: like--flag=doubledashSouSingh commentedon Sep 16, 2023
Hello @kushal-kumaran I try to run it on my device I get some output I hope that will help

ericvsmith commentedon Sep 18, 2023
I completely disagree with this. Imagine if you were reading the documentation of a command line utility, and it said "If you want the output file to be named '--', then use 'doubledash' instead, and this will be translated to '--' internally. It is not possible to specify an output name of 'doubledash'."
I think this is a completely valid bug report. I'm not sure it's fixable, given all of the issues with argparse and how it scans arguments. I am surprised that using
=--doesn't work. See #53580 for a case where using=was suggested as a partial workaround.pythongh-109475: Fix support of explicit option value "--" in argparse
gh-109475: Fix support of explicit option value "--" in argparse (GH-…
pythongh-109475: Fix support of explicit option value "--" in argparse (
[3.11] pythongh-109475: Fix support of explicit option value "--" in …
[3.12] gh-109475: Fix support of explicit option value "--" in argpar…
[3.11] gh-109475: Fix support of explicit option value "--" in argpar…
pythongh-109475: Fix support of explicit option value "--" in argparse (