Michael Herold added the comment:

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.

----------
Added file: http://bugs.python.org/file41984/fallback.py

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

Reply via email to