Bruce Leban schrieb:
Here's what I'd like:
def myfunc(a, b, c = *lambda: expression): stuff
The use of the lambda keyword here makes the scope of any variables in the expression clear. The use of the prefix * makes the syntax invalid today, suggests dereferencing and doesn't hide the overhead.
@calldefaults def myfunc(a, b, c = lambda: expression): pass
which should be possible without introducing new syntax.