Sure you can do it with a decorator. Although you might want one default to have this behavior and one not to. And putting the * right next to the lambda makes this a bit more explicit to my eye.
--- Bruce
Georg Brandl
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.
Why not
@calldefaults def myfunc(a, b, c = lambda: expression): pass
which should be possible without introducing new syntax.
Georg
_______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas