paul j3 added the comment:

This call used to be

    namespace, arg_strings = parser.parse_known_args(arg_strings, namespace)

But in 2014 (2.7.9) http://bugs.python.org/issue9351 was implemented

As noted in the title and comment in the code, the idea was to give more power 
to the defaults set in the subparser.

But as noted in the subsequent posts, the patch has raised some backward 
compatibility issues.

Generally having the action for one argument depend on the value of another 
argument is tricky, because arguments may be parsed in any order. (but there is 
a 'test_argparse.py' case that does that kind of testing).  It is safer to test 
for any interactions after parsing is all done.

Now in the subparser case, there is an order.  Main parser arguments have to 
come first.

I suggested in 9351 a way of allowing both behaviors - use of new namespace or 
use of the existing one.  But as you can see there hasn't been any further 
action in the past 2 years.

----------
nosy: +paul.j3

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

Reply via email to