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 quabla
Recipients brett.cannon, quabla
Date 2016-02-21.13:05:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1456059936.92.0.422715379908.issue26394@psf.upfronthosting.co.za>
In-reply-to
Content
Thank you for clarifying my request. Callables sound like a great solution to me!

Looks like the fallback should be called in `take_action()` if argument_values is "empty" (None?). Per default it should be transparent to an `Action` if the values are based on a fallback call. However, it might be useful to call `Action` with two additional parameters like `commandline_values` and `fallback_values` such that a (custom) action 'append_with_fallback' can be realized. Calling the fallback each time (required for `fallback_values`) makes it some kind of early called hook for argparse.

I am attaching a sketch of what might be a typical use case. I noted that a callable supplied to fallback would usually rely on informations that could be provided as `action.long_option_names` and `action.is_positional` to avoid that this logic is implemented outside of argparse again.

Please let me know I can provide any help.
History
Date User Action Args
2016-02-21 13:05:36quablasetrecipients: + quabla, brett.cannon
2016-02-21 13:05:36quablasetmessageid: <1456059936.92.0.422715379908.issue26394@psf.upfronthosting.co.za>
2016-02-21 13:05:36quablalinkissue26394 messages
2016-02-21 13:05:36quablacreate