>>>>> "MZ" == Moshe Zadka <moshez@math.huji.ac.il> writes: MZ> If MAL means dynamic scoping (which I understood he does), MZ> then this simply means: MZ> when looking for a variable "foo", you first search for it in MZ> the local namespace. If not there, the *caller's* namespace, MZ> and so on. In the end, the caller is the __main__ module, and MZ> if not found there, it is a NameError. This is how Emacs Lisp behaves, and it's used all the time in ELisp programs. On the one hand it's quite convenient for customizing the behavior of functions. On the other hand, it can make documenting the interface of functions quite difficult because all those dynamically scoped variables are now part of the function's API. It's interesting to note that many ELispers really hate dynamic scoping and pine for a move toward lexical scoping. I'm not one of them. I'm not as concerned about "fixing" nested functions because I hardly ever use them, and rarely see them much in Python code. Fixing lambdas would be nice, but since Guido considers lambdas themselves a mistake, and given that lamda use /can/ be a performance hit in some situations, does it make sense to change something as fundamental as Python's scoping rules to fix this eddy of the language? -Barry
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