[Tutor] imported scope

Kent Johnson kent37 at tds.net
Wed Apr 29 18:32:57 CEST 2009


On Wed, Apr 29, 2009 at 10:54 AM, spir <denis.spir at free.fr> wrote:
> Le Wed, 29 Apr 2009 10:05:04 -0400,
> Kent Johnson <kent37 at tds.net> s'exprima ainsi:
>> There is some discussion here:
>> http://mail.python.org/pipermail/python-3000/2007-March/006161.html
>>
>> Short answer: __builtins__ is an implementation detail that you should
>> ignore.
>>
>> Kent
>>
>
> Right, thank you, Kent.
> The issue here is I cannot ignore __buitins__ (or __builtin__). Or maybe I don't understand your answer properly.
>
> Yop, sorry, I get it now. It's the same dict in both cases -- except __buitins__ is expanded in the second case... Not obvious! (Is that what you mean?)

What are you trying to do? Why can't you ignore __builtins__?

In your first example __builtins__ is a reference to a module. In the
second example it is the module's __dict__. The email thread I linked
to indicates that this is most likely a historical accident or
oversight.

Kent


More information about the Tutor mailing list