Hello Phillip, On Tue, Sep 23, 2003 at 12:09:18PM -0400, Phillip J. Eby wrote: > So, unless a module's dictionary were to reference the module (or functions > were to reference the module rather than (or in addition to) the module > dictionary), it seems the proposed semantics would lead to unexpected > results. Right. I'm not sure I understand the reasons behind the current module/globals relationship. As modules zap their globals with None when they are deallocated, we observe the following behavior: (foo.py) def g(): return 5 def f(): return g() >>> from foo import f >>> import sys; del sys.modules['test4'] >>> f() Traceback (most recent call last): File "<stdin>", line 1, in ? File "foo.py", line 4, in f return g() TypeError: 'NoneType' object is not callable Possibly far-fetched, but I wouldn't be surprized to find large applications that mess with sys.modules in some way. For example, in one case, to ensure that a whole collection of interdependent modules will be reloaded on demand after I detect a change in one of them, I'm simply removing them all from sys.modules. Armin
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