paul j3 <ajipa...@gmail.com> added the comment:

I haven't had a chance to study your longer posts, but it seems to me that the 
AddFruitAction example could just as well be implemented with 

    parser.add_argument('--color', nargs='*', action='append')

with post parsing processing to create the 'fruits' dicts from the appended 
lists.  

The basic logic of argparse is to accept optionals in any order, and 
positionals in strict positional order.  'nargs' allows us to pair any number 
of strings with each optional's flag.

While custom Action classes can implement interactions between arguments based 
on values in the namespace, it is usually easier to do this after parsing.  

But back to your core change, I wonder if adding a new nargs, such as '**' 
would be better than than the new parameter 'greedy_star=True'.  I prefer not 
to add parameters that are hard to document.  At this point in the argparse 
development, changes should be minimally invasive.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42973>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to