[Python-ideas] Default arguments in Python - the return
Scott David Daniels
Scott.Daniels at Acm.Org
Sun May 10 07:28:13 CEST 2009
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
x = 6
f1 = function_producer(x)
x = 4.1
y = 7
f2 = function_producer(3)
print x, y, f1(), f2()
del y
x = 45
print x, f1(), f2()
del x
print f1(), f2()
--Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-ideas
mailing list