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 berker.peksag, derks, paul.j3, spaceone
Date 2015-03-25.16:23:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1427300636.98.0.928900497665.issue23487@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-03-25 16:23:57paul.j3setrecipients: + paul.j3, berker.peksag, derks, spaceone
2015-03-25 16:23:56paul.j3setmessageid: <1427300636.98.0.928900497665.issue23487@psf.upfronthosting.co.za>
2015-03-25 16:23:56paul.j3linkissue23487 messages
2015-03-25 16:23:56paul.j3create