[New-bugs-announce] [issue17204] argparser's subparsers.add_parser() should accept an ArgumentParser

Chris Jerdonek report at bugs.python.org
Thu Feb 14 08:01:07 CET 2013

New submission from Chris Jerdonek:

Currently, argparser's subparsers.add_parser() method (for adding sub-commands) takes the following input:

"This object has a single method, add_parser(), which takes a command name and any ArgumentParser constructor arguments, and returns an ArgumentParser object that can be modified as usual."

(from http://docs.python.org/dev/library/argparse.html#argparse.ArgumentParser.add_subparsers )

It would be nice if one could also pass an ArgumentParser object to add_parser().  This would allow the composition of parsers.  For example, if a library exposed an ArgumentParser command-line API, one could expose that library's commands as a sub-command of the parent project's command-line API using add_parser().

components: Library (Lib)
messages: 182081
nosy: bethard, chris.jerdonek
priority: normal
severity: normal
stage: needs patch
status: open
title: argparser's subparsers.add_parser() should accept an ArgumentParser
type: enhancement
versions: Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list