On Sun, May 10, 2009 at 12:10 PM, Arnaud Delobelle email@example.com wrote:
Furthemore, by removing default arguments from the language, we can let people choose what semantics they want for default arguments. I.e, if they want them to be reevaluated each time, they could write the default decorator as follows (it is exactly the same as the one above except for a pair of parentheses that have been added on one line.
Cute, but that's still a subset of what the dynamic semantics would provide; the evaluated thunks would have access to the previously defined arguments:
def foo(a, b, d=(a*a+b+b)**0.5, s=1/d): return (a,b,d,s)
would be equivalent to
missing = object() def foo(a, b, d=missing, s=missing): if d is missing: d = (a*a+b+b)**0.5 if s is missing: s = 1/d return (a,b,d,s)