[Tutor] Thoughts on little lambda
Scott Widney
SWidney@ci.las-vegas.nv.us
Fri, 8 Mar 2002 14:23:54 -0800
> Errr...
>
> I tried this particular excersise and had a problem...
>
> ------------------------------------------------------
> Python 2.1.1 (#20, Jul 20 2001, 01:19:29) [MSC 32 bit
> (Intel)] on win32
> Type "copyright", "credits" or "license" for more information.
> IDLE 0.8 -- press F1 for help
> >>> def addn(n):
> return lambda x:x+n
> SyntaxError: local name 'n' in 'addn' shadows use of 'n' as
> global in nested
> scope 'lambda' (<pyshell#1>, line 1)
> ------------------------------------------------------
>
> Am I missing something?
from __future__ import nested_scopes
Scott