Zooko <zooko@zooko.com>: > Now what I would *like* is that instead of doing "import os" to load code, > instead the caller provides, or doesn't provide the os module as part of the > construction/invocation of A. > > I don't have a clear idea yet of how that could be implemented in a > Pythonic, compatible way. Maybe, instead of there being one ultra-global namespace for importing modules from, it should be part of a function's environment. By default a function invocation would inherit the "import environment" of it's caller, but the caller could override this to provide a more restricted environment. This would be equivalent to passing in a set of allowable modules as an implicit parameter to every call. Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+
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