Re: [Python-Dev] Accepting PEP 3154 for 3.4?

2013-11-26 Thread Larry Hastings
On 11/18/2013 07:48 AM, Guido van Rossum wrote: Clearly the framing is the weakest point of the PEP (== elicits the most bikeshedding). Indeed--it is still ongoing: http://bugs.python.org/issue19780 //arry/ ___ Python-Dev mailing list Python-De

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

2013-11-26 Thread Robert Kern
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'r

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

2013-11-26 Thread Paul Moore
On 26 November 2013 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.

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

2013-11-26 Thread Eli Bendersky
On Tue, Nov 26, 2013 at 9:53 AM, Glenn Linderman wrote: > Eli did give his use case... a front end for a program that has a > parameter "--sync", and a front end preprocessor of some sort was trying to > use "--sync-foo" as an argument, and wanted "--sync" to be left in the > parameters to send o

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

2013-11-26 Thread Eli Bendersky
On Tue, Nov 26, 2013 at 9:46 AM, R. David Murray wrote: > On Tue, 26 Nov 2013 09:30:10 -0800, Eli Bendersky > wrote: > > Hello, > > > > argparse does prefix matching as long as there are no conflicts. For > > example: > > > > argparser = argparse.ArgumentParser() > > argparser.add_argument('--syn

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

2013-11-26 Thread Glenn Linderman
Eli did give his use case... a front end for a program that has a parameter "--sync", and a front end preprocessor of some sort was trying to use "--sync-foo" as an argument, and wanted "--sync" to be left in the parameters to send on to the back end program. Design of the front-end might bett

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

2013-11-26 Thread Eli Bendersky
On Tue, Nov 26, 2013 at 9:38 AM, Guido van Rossum wrote: > I think matching on the shortest unique prefix is common for command line > parsers in general, not just argparse. I believe optparse did this too, and > even the venerable getopt does! I think all this originated in the original > (non-P

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

2013-11-26 Thread R. David Murray
On Tue, 26 Nov 2013 09:30:10 -0800, Eli Bendersky wrote: > Hello, > > argparse does prefix matching as long as there are no conflicts. For > example: > > argparser = argparse.ArgumentParser() > argparser.add_argument('--sync-foo', action='store_true') > args = argparser.parse_args() > > If I pa

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

2013-11-26 Thread Guido van Rossum
I think matching on the shortest unique prefix is common for command line parsers in general, not just argparse. I believe optparse did this too, and even the venerable getopt does! I think all this originated in the original (non-Python) GNU standard for long option parsing. All that probably expl

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

2013-11-26 Thread Eli Bendersky
Hello, argparse does prefix matching as long as there are no conflicts. For example: argparser = argparse.ArgumentParser() argparser.add_argument('--sync-foo', action='store_true') args = argparser.parse_args() If I pass "--sync" to this script, it recognizes it as "--sync-foo". This behavior is