George Sakkis wrote:
On Sun, May 10, 2009 at 1:28 AM, Scott David Daniels
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
In this version, x is resolved each time when function_producer is called which could be different each time. The x = 5 line is possible irrelevant.
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
In this version, x is resolved each time each of the returned inners is called, which could be different each time and which could be different from any of the times function_producer was called. Not equivalent. Given how often this issue is resuscitated, I am will consider raising my personal vote from -1 to -0. My friendly advice to anyone trying to promote a change is to avoid categorical (and false or debatable) statements like "Newbies get confused" (Some do, some do not) or "The intuitive meaning is" (to you maybe, not to me). Also avoid metaphysical issues, especially those that divide people.* Do focus on practical issues, properly qualified statements, and how a proposal would improve Python. Terry Jan Reedy * The initial argument for changing the meaning of int/int amounted to this: "integers are *merely* a subset of reals, therefore....". Those with a different philosophy dissented and the actual proposal was initially lost in the resulting fire.