On 3/12/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 3/12/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > > Ka-Ping Yee wrote: > > > > > We have "import as", though. If you want to import the default > > > builtins without using them as the builtins, you can say > > > > > > import __builtin__ as default_builtin > > > > Seems to me it would be better to rename the module > > to a non-double-underscore name. There's really nothing > > magical about the module itself, only the name used > > by global variable lookups. > > Not true; modifying the module affects every other module (except > those that have imported some alternative). This is why I renamed it > to __builtin__ sometime in the dark ages (way before introducing > __builtins__). I strongly disagree that it's "just" a regular module. > > > So just call the module 'builtins', and then you can do > > > > import builtins # get the module with no magic happening > > > > import mystuff as __builtins__ # change my builtin namespace > > > > import builtins as __builtins__ # restore default builtin namespace > > I'm still +1 on Ping's original proposal #3. >
+1 from me as well. If you want to change the built-in values then just import the individual objects into the global namespace, using ``import *`` if you really want to shadow everything. -Brett _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
