> >>> import __main__ as m # I know, not general, just for trial > >>> m.c=3 > > Isn't (in 3.0) the notion of being able to modify another module's globals > supposed to get restricted to help out (among other things) the compiler? > If so, this use, even though it's not really modifying a global in another > module, might not work forever. That's one reason why I'd rather continue to use 'global' than some attribute assignment. To the compiler, module globals are more special than class variables etc. because they can shadow builtins. Therefore the compiler would like to know about *all* assignments to module globals. Similarly, assignment to locals in outer scopes need to be known to the compiler because it must make sure that all locals referenced by inner scopes are implemented as cells. --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