__builtins_ weirdness

Fredrik Lundh fredrik at pythonware.com
Wed Dec 1 18:57:06 EST 1999


Juergen A. Erhard <jae at ilk.de> joins the "if I don't
understand it, it has to be a bug" crowd:

> Now, I twiddled with this in the interactive interpreter, where the
> obvious __builtins__.range works (with __name__=="__main__").
> 
> But in a module, __builtins__ `magically' transforms into a dict...
> 
> I only wish there would be some consistency here.

it's spelled "__builtin__", and you have to import it
before you can use it.

__builtins__ is an implementation detail.  don't use
it unless you know exactly what you're doing.  period.

> Or some *very* good explanation.

why?  I'm pretty sure nobody here told you to use
__builtins__ instead of __builtin__, right?

</F>





More information about the Python-list mailing list