Message 385732 - Python tracker

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Content
This sounds very good to me.  Might also want action='store_capture' for a single positional definition?

capture could be a string, or any iterable of strings (tuple comes to mind)

capture_once have similar value as capture, but I wonder if the naming would be better as capture_reset to indicate the value is reset to default, rather than just captured.


Tadek said:
There could be new predefined action, e.g. 'extend_with_capture' (or just 'extend_capture') which could be used like this:

  parser.add_argument('fruits', nargs='*', action='extend_capture', capture_once=['color'])

Where 'capture' would be one of: a list of parameters to capture (could be a string instead of a list if it's just one parameter) or '*' to capture all optional parameters and 'capture_once' would be similar list of parameters to capture and reset to default.