[Python-Dev] Handling of sys.args (Re: User's complaints) (original) (raw)
Guido van Rossum guido at python.org
Fri Jul 14 21:48:56 CEST 2006
- Previous message: [Python-Dev] Handling of sys.args (Re: User's complaints)
- Next message: [Python-Dev] Handling of sys.args (Re: User's complaints)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Whoa, whoa. What's the problem we're trying to solve here?
On 7/14/06, Nick Coghlan <ncoghlan at gmail.com> wrote:
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 builtinmodulenames copyright excinfo() execprefix executable exit([arg]) getdefaultencoding() getfilesystemencoding() getwindowsversion() hexversion platform prefix stdin stdout stderr version versioninfo winver
Arguably privileged information (no real reason for non-privileged code to know this stuff): subversion getcheckinterval() getdlopenflags() dllhandle currentframes() getrefcount(object) getrecursionlimit() getframe([depth]) displayhook excepthook stdin stdout stderr apiversion warnoptions tracebacklimit displayhook(value) excepthook(type, value, traceback) ps1 ps2 Definitely privileged operations: Actually setting any of the above to something different modules path excclear() setcheckinterval(interval) setdefaultencoding(name) setdlopenflags(n) setprofile(profilefunc) setrecursionlimit(limit) settrace(tracefunc) settscdump(onflag) Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org
Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] Handling of sys.args (Re: User's complaints)
- Next message: [Python-Dev] Handling of sys.args (Re: User's complaints)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]