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.

Author v+python
Recipients monkeyman79, paul.j3, r.david.murray, v+python
Date 2021-01-26.19:56:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1611690974.66.0.286979817742.issue42973@roundup.psfhosted.org>
In-reply-to
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.
History
Date User Action Args
2021-01-26 19:56:14v+pythonsetrecipients: + v+python, r.david.murray, paul.j3, monkeyman79
2021-01-26 19:56:14v+pythonsetmessageid: <1611690974.66.0.286979817742.issue42973@roundup.psfhosted.org>
2021-01-26 19:56:14v+pythonlinkissue42973 messages
2021-01-26 19:56:14v+pythoncreate