A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2013-November/130609.html below:

[Python-Dev] potential argparse problem: bad mix of parse_known_args and prefix matching

[Python-Dev] potential argparse problem: bad mix of parse_known_args and prefix matching [Python-Dev] potential argparse problem: bad mix of parse_known_args and prefix matchingRobert Kern robert.kern at gmail.com
Tue Nov 26 22:15:56 CET 2013
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

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4