type(__builtins__) strangeness

Tavis Rudd tavis at calrudd.com
Fri Nov 9 21:48:47 CET 2001


Hi, 
why does type(__builtins__) return <type 'module'> when called in the
__main__ scope and <type 'dictionary'> when called inside an imported
module?

## a.py 
print type(__builtins__)

## from the interactive prompt
>>> import a
<type 'dictionary'>
>>>print type(__builtins__)
<type 'module'>

Cheers,
Tavis



More information about the Python-list mailing list