New submission from Nick Papior: 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. ---------- components: Library (Lib) files: argparse_subspacenamespace.py messages: 273654 nosy: Nick Papior priority: normal severity: normal status: open title: argparse - subparsers does not retain namespace type: enhancement versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6 Added file: https://bugs.python.org/file44222/argparse_subspacenamespace.py _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue27859> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com