not at Python Bugs -- __builtins__ madness

Fredrik Lundh effbot at telia.com
Sat Mar 11 16:59:11 EST 2000


Jeff Pinyan <jeffp at crusoe.net> wrote:
> Could some please explain how Python makes this mistake?

what makes you think it's a mistake?

>   jeffp at friday [4:15pm] bin #324> python
>   Python 1.5.2 (#1, Apr 20 1999, 08:57:03)  [GCC 2.7.2.3] on sunos5
>   Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>   >>> __builtins__
>   <module '__builtin__' (built-in)>
>
> It got the module name wrong.  Unless Python treats __builtins__ THAT
> specially, that's a major goof.  And the 1.5.2 docs say it's __builtin__.
> This boggles my poor mind.  I'm checking Python Bugs...

"__builtins__" is a reference to a module containing the
built-in primitives (abs, len, exceptions, etc).

they're (usually) provided by a module named __builtin__.

if you want to explicitly refer to this module, make sure to
do "import __builtin__".  the __builtins__ module attribute
should be treated as an implementation detail.

</F>





More information about the Python-list mailing list