Guido van Rossum wrote: >>>I'd be happy to proclaim that doing something like >>> >>> import X >>> d = X.__dict__ >>> d["spam"] = 42 # or exec "spam = 42" in d >>> >>>is always prohibited. >> >>That would break lazy module imports such as the one I'm using >>in mx.Misc.LazyModule.py. > > But you could rewrite LazyModule.py to use setattr(X, "spam", 42), right? Sure. > I don't think it's worth it to have a dict proxy that allows certain > keys to be set but not others. The question is: why make this complicated ? If the programmer enables __fast_builtins__ (or similar) in the module scope, she should be aware that tweaking the module globals from the outside won't have the desired effect. -- Marc-Andre Lemburg eGenix.com Professional Python Software directly from the Source (#1, Mar 28 2003) >>> Python/Zope Products & Consulting ... http://www.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ Python UK 2003, Oxford: 4 days left EuroPython 2003, Charleroi, Belgium: 88 days left
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