Movatterモバイル変換


[0]ホーム

URL:


Nested Scopes in Idle/PythonWin

Jeremy Hyltonjeremy at digicool.com
Sun Apr 22 15:27:47 EDT 2001


>>>>> "GC" == Greg Chapman <glc at well.com> writes:  GC> 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?  >>  GC> No, I'm talking about the interactive interpreter:  GC> Python 2.1 (#15, Apr 16 2001, 18:25:49) [MSC 32 bit (Intel)] on win32  GC> Type "copyright", "credits" or "license" for more information.  GC> IDLE 0.8 -- press F1 for help  GC> >>> def make_adder(x):  GC> return lambda y: x+y  GC> SyntaxError: local name 'x' in 'make_adder' shadows use of 'x' as global in  GC> nested scope 'lambda' (<pyshell#1>, line 1)You didn't tell the interpreter that you wanted to use nested scopes.>>> from __future__ import nested_scopes>>> def make_adder(x):...return lambda y: x + y... >>>Jeremy


More information about the Python-listmailing list

[8]ページ先頭

©2009-2025 Movatter.jp