paul j3 added the comment: http://stackoverflow.com/a/20167038/901925 is an example of using `_parser_class` to produce different behavior in the subparsers.
parser = ArgumentParser() parser.add_argument('foo') sp = parser.add_subparsers(dest='cmd') sp._parser_class = SubParser # use different parser class for subparsers spp1 = sp.add_parser('cmd1') spp1.add_argument('-x') spp1.add_argument('bar') spp1.add_argument('vars',nargs='*') In this case the SubParser class implements a `parse_intermixed_known_args` method that handles that `nargs='*'` argument. http://bugs.python.org/issue14191 It shouldn't be hard to add `parser_class` as a documented optional argument to `add_subparsers`. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17204> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com