paul j3 added the comment: OK, so you are thinking about what happens to the subparsers `dest` when the user names a command. That isn't handled by the `store` action, but by the call of the subparsers action
class _SubParsersAction(Action): .... def __call__ .... # set the parser name if requested if self.dest is not SUPPRESS: setattr(namespace, self.dest, parser_name) ... namespace, arg_strings = parser.parse_known_args(arg_strings, namespace) Storing the parser_name is a minor part of this action. The important, distinctive part is passing the parsing action to that subparser. That storing could be done in an append way, but why? There can only one `subparsers`, and it can be invoked only once. None of the existing Action classes can replace _SubParsersAction, which is entered in the `registry` as `parsers`: In [11]: parser._registry_get('action','parsers') Out[11]: argparse._SubParsersAction If you want to write your own version of this action, you can use it, either by replacing the existing class, or by changing this registry entry. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23487> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com