I believe this is a rebirth of a request that has come up many times before,
which is to have something like javascript's `undefined` where it means "use
the default value" if passed to a function that has a default value or "value
not provided" (slightly different to "None").
>> def foo(x, y=1):
... return x, y
>> foo(undefined, undefined)
undefined, 1
The idea being that wrapper functions don't need to then know what the default
is for the function they wrap:
def outermost_wrapper(b, c=undefined):
return inner_wrapper(5, b, c)
def inner_wrapper(a, b=undefined, c=undefined):
return func(a, b, c)
def func(a=1, b=2, c=3):
return a*b*c
"undefined" would either have to be an alias for "None" everywhere _except_
function signatures, or be only allowed in function signatures and have special
handling. It opens up a can of worms in javascript but has its uses.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/KO4FUF45RA6CJXEWQXOKOOOYC3RMFPIZ/
Code of Conduct: http://python.org/psf/codeofconduct/