[Doc-SIG] Finding cannonical names for objects

Edward D. Loper edloper@gradient.cis.upenn.edu
Sat, 21 Apr 2001 22:59:58 EDT


> Edward D. Loper writes:
>  > p.s., Is there a reason that __builtins__.__name__ == '__builtin__'
>  > instead of '__builtins__'?
> 
>   Yes; the same reason that "import __builtin__" works but "import
> __builtins__" does not.  ;-)

Ok.  I guess maybe my question should have been why the default global
(?) variable to access them is called "__builtins__" rather than
"__builtin__"::

    Python 2.1 (#1, Apr 21 2001, 20:23:34) 
    [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2
    Type "copyright", "credits" or "license" for more information.
    >>> dir()
    ['__builtins__', '__doc__', '__name__']
    >>> type(__builtins__), __builtins__.__name__
    (<type 'module'>, '__builtin__')

-Edward