On 7/13/06, Ka-Ping Yee <[EMAIL PROTECTED]> wrote: > On Thu, 13 Jul 2006, Greg Ewing wrote: > > Would it help if sys were pre-imported into the builtins? > > Or do you think that args shouldn't live in sys at all? > > I feel like the command-line arguments don't really belong in sys, > and i'd rather not have 'sys' pre-imported into the builtins. > > I think of 'sys' as the place for sensitive interpreter internals > and the builtins as the place for harmless functions. They're at > opposite ends of the scale -- 'sys' is the most privileged; > builtins are the least privileged. From a security point of view, > 'import' is the main way to get dangerous new functionality. > I realize 'open' breaks this concept, but it's nice to be able to > say, to a rough approximation, that preventing 'import' gives you > an interpreter that can do computations but isn't a security risk. > > These are just my feelings -- i'm not sure how consistent this is > with the original intent of 'sys'. I think it would be a quite > useful distinction to have, though.
sys is a grab-bag. Note that it also has a good deal of harmless read-only data: maxint, version, platform and many more. But it seems to specialize in things that you may modify to change global behavior: path, modules, stdout, ps1, displayhook and others. I'nm afraid if we were to split it by functionality we'd have to split it 5-way or so... > > And while we're on the subject, anyone think it would > > be a good idea to drop the silly feature of having > > the program name as args[0]? You almost *never* want > > to treat it the same way as the rest of the args, > > so the first thing you always do is args[1:]. > > Starting the args array with the first argument (and putting > the program name somewhere else) seems Pythonic to me. As long as it's called args, not argv, I agree. -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com