>>> def p(x): print(x) ... >>> f = lambda x:p(x) >>> f(5) 5 >>> f = lambda x:print(x) File "", line 1 f = lambda x:print(x) ^ SyntaxError: invalid syntax >>> def counter(x): ... base = x ... def inc(): ... oldbase = base ... base = base + 1 ... return oldbase ... return inc ... >>> c = counter(5) >>> c() Traceback (most recent call last): File "", line 1, in ? File "", line 4, in inc UnboundLocalError: local variable 'base' referenced before assignment