Nested Scopes
Nested scopes and lambda
- Older versions of python
def foo():
a = 0.5
b = 1.5
c = 2
d = 4
# Call a function with a callback
plot_function(lambda x,a=a,b=b,c=c,d=d: a*(x**3) + b*(x**2) + c*x + d)
- Python 2.1:
def foo():
a = 0.5
b = 1.5
c = 2
d = 4
plot_function(lambda x: a*(x**3) + b*(x**2) + c*x + d)
|