Ka-Ping Yee <[EMAIL PROTECTED]> wrote: > Most other languages that support lexical scoping (including Scheme, > JavaScript, Ruby, Perl, E, Java, Smalltalk) provide a uniform way > to read and write to scopes at all levels. This is done by letting > programmers specify the scope in which they want a variable bound > (usually with a keyword like "var" in JavaScript, "my" in Perl, or > "define" in E).
That's not the Python way, IMO. I think the right way (assuming we actually want to allow it) is to introduce a pure assignment statement in addition to the assignment/declaration statement that we already have. For example: a = 1 def f(): b = 2 a := 2 def g(): b := 3 print a, b, c g() f() would print "2 3 4". The := would assign but not declare a variable in the current scope. Neil _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com