[Python-3000] builtin and builtins (original) (raw)
Guido van Rossum guido at python.org
Mon Mar 12 23:35:15 CET 2007
- Previous message: [Python-3000] __builtin__ and __builtins__
- Next message: [Python-3000] __builtin__ and __builtins__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 3/12/07, Greg Ewing <greg.ewing at canterbury.ac.nz> 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 defaultbuiltin 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.
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-3000] __builtin__ and __builtins__
- Next message: [Python-3000] __builtin__ and __builtins__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]