George Sakkis wrote:
On Sun, May 10, 2009 at 1:28 AM, Scott David Daniels <Scott.Daniels@acm.org> wrote:
Any argument for changing to a more "dynamic" default scheme had better have a definition of the behavior of the following code, and produce a good rationale for that behavior:
x = 5 def function_producer(y): def inner(arg=x+y): return arg + 2 return inner
I don't think the proposed scheme was ever accused of not being well-defined. Here's the current equivalent dynamic version:
x = 5 def function_producer(y): missing = object() def inner(arg=missing): if arg is missing: arg = x+y return arg + 2 return inner
So sorry. def function_producer(y): def inner(arg=x+y): return arg + 2 y *= 10 return inner I was trying to point out that it becomes much trickier building functions with dynamic parts, and fluffed the example. --Scott David Daniels Scott.Daniels@Acm.Org