__builtins__ wreidness

Laszlo Zsolt Nagy gandalf at geochemsource.com
Fri Apr 8 03:39:01 EDT 2005


Given this module "test.py":

print type(__builtins__)

I ran into a wreid thing.

Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> __builtins__
<module '__builtin__' (built-in)>
 >>> type(__builtins__)
<type 'module'>
 >>> import test
<type 'dict'>
 >>>

What? __builtins__ is a dict when used in a module, but it is a module 
when used interactively? Why?



-- 
_________________________________________________________________
  Laszlo Nagy		      web: http://designasign.biz
  IT Consultant		      mail: gandalf at geochemsource.com

     		Python forever!





More information about the Python-list mailing list