[New-bugs-announce] [issue4582] type of __builtins__ changes if in main module or not

Neal Norwitz report at bugs.python.org
Sun Dec 7 21:48:39 CET 2008


New submission from Neal Norwitz <nnorwitz at gmail.com>:

This happens on 2.4 and 3.0, probably all versions:

When running this simple program (save to a file):

print(type(__builtins__))
__import__(__file__.split('/')[-1][:-3])

I get:
<type 'module'>
<type 'dict'>


I would expect the type to be consistent regardless of whether executing
the main module or from the imported module.  I haven't looked into why
this is happening or if it makes sense.  It was unexpected.

----------
components: Interpreter Core
messages: 77252
nosy: nnorwitz
severity: normal
status: open
title: type of __builtins__ changes if in main module or not
type: behavior

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4582>
_______________________________________


More information about the New-bugs-announce mailing list