Update to PEP 227 (static scoping)

Denys Duchier Denys.Duchier at ps.uni-sb.de
Wed Feb 21 16:40:00 EST 2001


Jeremy Hylton <jeremy at alum.mit.edu> writes:

> Rebinding names in enclosing scopes
> 
>     There are technical issues that make it difficult to support
>     rebinding of names in enclosing scopes, but the primary reason
>     that it is not allowed in the current proposal is that Guido is
>     opposed to it.  It is difficult to support, because it would
>     require a new mechanism that would allow the programmer to specify
>     that an assignment in a block is supposed to rebind the name in an
>     enclosing block; presumably a keyword or special syntax (x := 3)
>     would make this possible.

if "global x" was instead allowed to mean "the x in the innermost
enclosing scope that defines one (or the global scope otherwise)",
wouldn't that solve the problem.  It wouldn't be semantically backward
compatible, but, in practice, would that break a lot of existing
programs and require too high a cost for fixing them?  Just wondering.

Cheers,

-- 
Dr. Denys Duchier			Denys.Duchier at ps.uni-sb.de
Forschungsbereich Programmiersysteme	(Programming Systems Lab)
Universitaet des Saarlandes, Geb. 45	http://www.ps.uni-sb.de/~duchier
Postfach 15 11 50			Phone: +49 681 302 5618
66041 Saarbruecken, Germany		Fax:   +49 681 302 5615



More information about the Python-list mailing list