On 07 Jan 2005 14:38:01 +0100, Jacek Generowicz <[EMAIL PROTECTED]> wrote: [...] > >[*] Funnily enough, getting them to understand that "lambda x: fn(x)" > is just a very silly way of writing "fn", can be quite a struggle > at times ... but that's probably a consequence of the context in > which lambda is introduced. Actually, it may _usually_ be silly, but it could be a way of deferring a name lookup instead of using the current binding of a name:
>>> def bar(): return 'this is bar' ... >>> def foo(f=bar): print f() ... >>> def bar(): return 'this is updated bar' ... >>> foo() this is bar >>> def foo(f=lambda:bar()): print f() ... >>> foo() this is updated bar >>> def bar(): return 'this updated bar was picked up by silly lambda' ... >>> foo() this updated bar was picked up by silly lambda Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list