__builtins__ changes types

echuck at mindspring.com echuck at mindspring.com
Fri Oct 27 14:04:04 EDT 2000


It appears that __builtins__ changes types. It can be either a
dictionary or a module. Anyone know why?

# one.py
def main():
	print 'type of __builtins__:', type(__builtins__)

if __name__=='__main__':
	main()


# two.py
import one
one.main()


> python one.py
type of __builtins__: <type 'module'>

> python two.py
type of __builtins__: <type 'dictionary'>


I didn't see anything in the FAQ on this.

This is Py2 on Win32:
Python 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)] on win32


-Chuck
--
http://webware.sourceforge.net



Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list