[Python-ideas] parameter omit
Josiah Carlson
jcarlson at uci.edu
Fri May 11 03:03:35 CEST 2007
"Aaron Brady" <castironpi at comcast.net> wrote:
> Also, any follow-up on this? (I posted at top.)
I don't like it. The current calling semantics are sufficient for the
vast majority of cases. For those cases that are not covered by the
current calling semantics, there is a PEP for allowing variations in
optional arguments, keyword arguments, etc. I can't remember the number,
but the PEP index has it.
As for signaling "use the default", there is a standard method: omit the
argument. If you want the argument to always be required to be a
keyword argument, you can use...
def foo(arg1, **kwargs):
arg2 = kwargs.get('arg2', 1.2325)
arg3 = kwargs.get('arg3', 'hello')
...
- Josiah
More information about the Python-ideas
mailing list