[Python-Dev] Re: [Pythonmac-SIG] __builtins__ a dictionary or
a module?
Jonathan Wight
JWight@bigfoot.com
Fri, 06 Apr 2001 09:57:59 -0500
On 4/6/01 4:06 AM, "Tim Peters" <tim.one@home.com> wrote:
> Please read this the right way <wink>: it's none of your business whether
> __builtins__ is a module or a dictionary.
OK, I can live with that. I was wondering why it was 'magically just
working' anyways.
> BTW, the primary reason __builtins__ is a module when bringing up a native
> command-line shell (I know that doesn't apply on a Mac Classic) is simply so
> that if a curious user types
>
>>>> __builtins__
>
> they get
>
> <module '__builtin__' (built-in)>
>
> instead of a giant dict dump. The primary use for making __builtins__ a dict
> is to support restricted execution modes.
Well I'd like to make my code (a Python IDE) treat __builtins__ as a module
so I'll look and see if there's a way of doing that. But it's not the end of
the world if I can't.
Thanks Tim providing the answers and Jack for investigating.
Jon.