Bryan Olson <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] wrote: > > There are already anonymous functions in Python. > > lambda x, y, z: x + y + z > > is the same as: > > def _(x, y, z): return x + y + z > > They are the same only in special cases: > The special identifier "_" is used in the interactive > interpreter to store the result of the last evaluation...
I'm not sure what Chris was really getting at, since among other things lambda:... is an expression while def... is a statement. But Python certainly has anonymous functions without lambda: def compose(f,g): def h(*a, **k): return f(g(*a, **k)) return h x = compose(math.sin, math.cos)(1.0) computes sin(cos(1.0)) where a function equivalent to lambda x: sin(cos(x)) is constructed and used without being bound to a symbol. -- http://mail.python.org/mailman/listinfo/python-list