[issue23487] argparse: add_subparsers 'action' broken
SpaceOne
report at bugs.python.org
Wed Mar 25 11:49:24 CET 2015
SpaceOne added the comment:
In replay to msg238931 from paul j3 (paul.j3) *
> And specifying something other than the default 'store' action class for the arguments of the parsers doesn't make sense.
Of course it makes sense. If you e.g. want the action to be 'append' so that the subparser-name is appended to a already existing list / or to create a new list with the subparser-name as first argument.
E.g.:
parser.add_subparser(dest='foo', action='append')
parser.parse_args('bar').__dict__ == {'foo': ['bar']}
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23487>
_______________________________________
More information about the Python-bugs-list
mailing list