[Python-ideas] Collection type argument for argparse where nargs != None
Stephen J. Turnbull
turnbull.stephen.fw at u.tsukuba.ac.jp
Mon Aug 7 02:36:58 EDT 2017
David Mayo writes:
> I mean, it's definitely possible, but I'd argue that's actually not any
> more explicit - and, in fact, args.stuff = something(args.stuff) is
> arguably less explicit because it's just an arbitrary transform, rather
> than being called out as "this is the wrapper element for these
The problem is third parties trying to read and work with the code,
who now have to go read not only the definition of the parser, but the
definition of the wrapper element (which is an arbitrary transform
with a specified role).
I think argparse is complex enough already. For both of your use
cases (argparsers as reusable components and validation of collection
arguments), I don't see why they can't be done in a subclass.
This argument doesn't kill your proposal, and I'm just one rando, but
FWIW I'm -0.5 on it for now.
More information about the Python-ideas