This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.j3
Recipients ericvw, nickpapior, paul.j3
Date 2016-09-04.04:54:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1472964881.32.0.196117229885.issue27859@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-09-04 04:54:41paul.j3setrecipients: + paul.j3, ericvw, nickpapior
2016-09-04 04:54:41paul.j3setmessageid: <1472964881.32.0.196117229885.issue27859@psf.upfronthosting.co.za>
2016-09-04 04:54:41paul.j3linkissue27859 messages
2016-09-04 04:54:40paul.j3create