Author nickpapior
Recipients nickpapior
Date 2016-08-25.15:02:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Using argparse does not retain the Namespace variable across sub-parsers.

This prohibits customization of Actions due to "upper" level arguments not being stored in the namespace passed to the sub-parsers.

Hence, one may not create different sub-parsers which depend on an upper level flag.

The reason is the subparser command:
    subnamespace, arg_strings = parser.parse_known_args(arg_strings, None)

Which by default passes `None` as the namespace argument.

A simple patch would be to copy the original namespace, which may then be altered. And subsequently restored, based on changes to that namespace.
Date User Action Args
2016-08-25 15:02:10nickpapiorsetrecipients: + nickpapior
2016-08-25 15:02:10nickpapiorsetmessageid: <>
2016-08-25 15:02:10nickpapiorlinkissue27859 messages
2016-08-25 15:02:10nickpapiorcreate