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
-1 for changing the current semantics (too much potential breakage), +0.x for a new keyword that adds dynamic semantics (and removes the need for the sentinel kludge).