Glenn Linderman added the comment:

Very nice, Paul.

I tested that with some of my applications, and some of my test cases. All of 
them initially failed, because you have parse_intermixed_args returning 
parameters like parse_known_args instead of like parse_args. Now I can 
understand that might be a little confusing in msg166175, but note that the 
implementation is "like" a call to parse_known_args followed by a call to 
parse_args... strongly implying that the return should be like parse_args.

After tweaking your implementation in that regard, then I was able to get all 
the same applications and test cases to pass, although I haven't tried all my 
applications and all my test cases, as yet.

Your techniques for disabling particular parameters are pretty clever.

I think the difficult cases should raise an error. 

Firstly, parse_intermixed_args is intended to be for functional compatibility 
with optparse functionality, which doesn't support the difficult cases, 
therefore use of the difficult cases would require additional restrictions on 
the allowed order of options on the command line, beyond what optparse 
supports... this would be an application interface change, and as part of that 
interface change, should such happen, the flexibility of intermixing optionals 
and positionals can be restricted.

Secondly, if an understanding of how to define the use parse_intermixed_args 
with one or more of the difficult cases is reached, replacing an error case 
with a functional case is possible, but replacing one silent functionality with 
a different one is a backwards compatibility problem. Throwing an error avoids 
limiting a future definition of these cases.

The freedom of mixing optionals and positionals that would available in the now 
deprecated optparse does seem to be restored by this patch.

I look forward to seeing a revised patch, this is a very promising solution to 
this bug.

----------

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

Reply via email to