[issue9351] argparse set_defaults on subcommands should override top level set_defaults

paul j3 report at bugs.python.org
Sun Sep 4 12:45:54 EDT 2016


paul j3 added the comment:

In http://bugs.python.org/issue27859 I've demonstrated how a subclass of _SubParsersAction can be used to revert the behavior to pre 2.7.9, passing the main namespace to the subparser.

The only other change is to the parser registry:

    parser.register('action', 'parsers', MyParserAction)

So there's no need to change the argparse.py file itself.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9351>
_______________________________________


More information about the Python-bugs-list mailing list