[Python-Dev] potential argparse problem: bad mix of parse_known_args and prefix matching
Robert Kern
robert.kern at gmail.com
Tue Nov 26 22:15:56 CET 2013
More information about the Python-Dev mailing list
Tue Nov 26 22:15:56 CET 2013
- Previous message: [Python-Dev] potential argparse problem: bad mix of parse_known_args and prefix matching
- Next message: [Python-Dev] potential argparse problem: bad mix of parse_known_args and prefix matching
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2013-11-26 18:16, Eli Bendersky wrote: > FWIW I'm not advocating a breaking behavior change here - I fully realize the > ship has sailed. I'm interested in mitigation actions, though. Making the > documentation explain this explicitly + adding an option to disable prefix > matching (in 3.5 since we're past the 3.4 features point) will go a long way for > alleviating this gotcha. There is already the One Obvious Way to handle situations like yours: the user uses "--" to mark that the remaining arguments are pure arguments and not --options. parent-script --verbose -- ./child_script.py --no-verbose --etc This is a common idiom across many argument processors. parse_known_args() is not a good solution for this situation even if you mitigate the prefix issue. Exact matches of --options are still possible. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
- Previous message: [Python-Dev] potential argparse problem: bad mix of parse_known_args and prefix matching
- Next message: [Python-Dev] potential argparse problem: bad mix of parse_known_args and prefix matching
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list