[issue9253] argparse: optional subparsers

Steven Bethard report at bugs.python.org
Tue Nov 16 09:04:39 CET 2010


Steven Bethard <steven.bethard at gmail.com> added the comment:

I think the proposed API looks fine and should be backwards compatible since add_subparsers will currently throw an exception with a default= argument.

In case someone feels like writing a patch, you'll want to look at _SubParsersAction.__init__, which will need to grow the default= argument, and pass a different nargs= argument on. I think you'll need to define a new nargs type which means you probably also need to look at ArgumentParser._get_nargs_pattern as well.

----------

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


More information about the Python-bugs-list mailing list