Nested Scopes in Idle/PythonWin

Steve Holden sholden at holdenweb.com
Sun Apr 22 16:01:24 EDT 2001


"Greg Chapman" <glc at well.com> wrote in message
news:mailman.987963514.5400.python-list at python.org...
> On 22 Apr 2001 15:48:51 -0000, Steve Holden wrote:
> > Are you saying that IDLE won't correctly handle modules containing
> >
> >     from __future__ import nested_scopes?
> >
>
> No, I'm talking about the interactive interpreter:
>
> Python 2.1 (#15, Apr 16 2001, 18:25:49) [MSC 32 bit (Intel)] on win32
> Type "copyright", "credits" or "license" for more information.
> IDLE 0.8 -- press F1 for help
> >>> def make_adder(x):
> return lambda y: x+y
> SyntaxError: local name 'x' in 'make_adder' shadows use of 'x' as global
in
> nested scope 'lambda' (<pyshell#1>, line 1)
> >>>
>
Interesting. One of the problems of IDLE and PythonWin, of course, is that
they provide a "preconfigured" module space in which to run itneractive
commands. Sounds like this might be a toughie (hence your umpteen-line
patch). Really the IDEs should offer a command-line option to switch on this
(and other optional features). Did this perhaps get overlooked in the
development process, or is it covered in the release notes?

glad-I-haven't-yet-switched-ly y'rs  - StEvE






More information about the Python-list mailing list