Michael Herold added the comment:
Yes, a fallback hook at the end of parsing would have to be placed >
before the 'required' testing, not after as in my 'group' testing.
Just to clarify: Would you suggest that a fallback call returns the
parsed value (i.e. the fallback ca
Michael Herold added the comment:
Thanks so much for looking into my patch!
Let me start by outlining that I don't understand how your alternate
solutions are coping with the key problem. You are assuming that you get
a populated Namespace object. However, `_parse_known_args` is exiti
Changes by Michael Herold :
Added file: http://bugs.python.org/file42062/example.py
___
Python tracker
<http://bugs.python.org/issue26394>
___
___
Python-bugs-list mailin
Michael Herold added the comment:
I have prepared a working patch to sketch how this could be implemented. A
small example (example.py) shows how this feature can be used to implement a
fallback to environment variables.
This patch allows Currying of positional arguments (i.e. you can give
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
New submission from Michael Herold:
argparse has at least three features to set defaults (default=, set_defaults(),
argument_default=). However, there is no feature to set the values of
arguments.
The difference is, that a required argument has to be specified, also if a
default value