I don't think I buy your explanation that Python uses dynamic scope for resolving globals. As I understand the mechanism, the module namespace and builtins namespace are those for the module in which the function was defined. If so, this is still static scope. Here's a quick example that illustrates the difference: module foo: ----------------------- a = 12 def add(b): return a + b ----------------------- module bar: ----------------------- from foo import add a = -1 print add(1) ----------------------- If Python used static scope, "python bar.py" should print 13 (it does). If it used dynamic scope, I would expect the answer to be 0. Jeremy
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