> Well, the listed variables are "global" to the current local scope. > I find the rename argument a bit specious. If I rename a function I > have to change all the references to it today. This is just one > more. Since "global" is a declarative statement, the compiler can > tell you immediately that it can't find the old function name. Right, I tend to agree. > Guido> I saw a variant where the syntax was > Guido> 'global' vars 'in' 'def' > Guido> which solves that concern (though not particularly elegantly). > > I don't see how that can work though. What does 'def' mean in this > case? There can be multiple lexically enclosing functions, any of > which have the same local variable x which you might want modify. Yeah, but usually that's not a problem. The compiler knows about all those x-es, and uses the innermost (nearest) one. This matches what it does when *referencing* a non-local variable, which doesn't need a global statement. --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4