Ian Kelly <ian.g.ke...@gmail.com> writes: > Nope. You do end up with a lot of nested filter objects, but there's > no recursion in the Python code, which means that you're not piling up > frame objects, and you'll never hit the interpreter's recursion limit.
I think you do get frame objects. A quick experiment: def d(fuel): f = lambda x:x for i in range(fuel): f = lambda x,g=f: 1+g(x) return f >>> d(3) <function <lambda> at 0x1a3b9b0> >>> d(100)(0) 100 >>> d(1000)(0) Traceback (most recent call last): File "<pyshell#24>", line 1, in <module> d(1000)(0) File "<pyshell#20>", line 3, in <lambda> for i in range(fuel): f = lambda x,g=f: 1+g(x) File "<pyshell#20>", line 3, in <lambda> [ 1000's of lines snipped ] RuntimeError: maximum recursion depth exceeded >>> This happens in both 2.7 and 3.3.4. -- https://mail.python.org/mailman/listinfo/python-list