[Python-3000] builtin and builtins (original) (raw)

Ka-Ping Yee python at zesty.ca
Mon Mar 12 08:17:33 CET 2007


On Mon, 12 Mar 2007, Greg Ewing wrote:

Changing main to match would seem to be a good idea. [...] There might be merit in renaming builtins to something less confusable, at the expense of breaking existing code which refers to it.

Cool.

I don't think it would be such a good idea to unify builtin and builtins, because then importing builtin would clobber the existing builtin namespace being used by the code -- which may not be the same thing.

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

If you want to reset the builtins to the default builtins:

import __builtin__

If you want to replace them with your own builtins:

import my_builtin as __builtin__

That doesn't seem so bad.

Hmm... when do you find yourself importing builtin?

-- ?!ng



More information about the Python-3000 mailing list