Greg Ewing wrote: > Maybe sys needs to be split into two modules, with > the non-sensitive one pre-imported (so that the > importless interpreter you suggest wouldn't be > unnecessarily crippled). Maybe not splitting it, but providing a read-only mechanism of getting at certain elements, with "import sys" still being the way of *modifying* any of these things. Relatively safe items (could be provided as attributes and methods of a read-only class instance in builtins instead of as a module): argv (as a tuple instead of a list) byteorder maxint maxunicode builtin_module_names copyright exc_info() exec_prefix executable exit([arg]) getdefaultencoding() getfilesystemencoding() getwindowsversion() hexversion platform prefix stdin stdout stderr version version_info winver Arguably privileged information (no real reason for non-privileged code to know this stuff): subversion getcheckinterval() getdlopenflags() dllhandle _current_frames() getrefcount(object) getrecursionlimit() _getframe([depth]) __displayhook__ __excepthook__ __stdin__ __stdout__ __stderr__ api_version warnoptions tracebacklimit displayhook(value) excepthook(type, value, traceback) ps1 ps2 Definitely privileged operations: Actually *setting* any of the above to something different modules path exc_clear() setcheckinterval(interval) setdefaultencoding(name) setdlopenflags(n) setprofile(profilefunc) setrecursionlimit(limit) settrace(tracefunc) settscdump(on_flag) Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org
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