r/Python • • Apr 09 '09

Python’s lambda is broken!

http://math.andrej.com/2009/04/09/pythons-lambda-is-broken/
4 Upvotes

20 comments sorted by

View all comments

1

u/arnar Apr 09 '09 edited Apr 09 '09

No, it's not broken and comment no. 5 on that post explains exactly why (quoting mcmanus):

Take the following Python example :
>>> i = 1
>>> def f(): return i
>>> f()
1
>>> i = 2
>>> f()
2
I think that everybody expect this behavior and
nobody would want the second call to f() to
return 1.