[issue25564] IDLE behaves differently that the standard interpreter when someone types `del __builtins__`

Steven D'Aprano report at bugs.python.org
Thu Nov 5 19:59:46 EST 2015


Steven D'Aprano added the comment:

__builtins__ is a private implementation detail in CPython. There is no guarantees made about whether it exists or not. E.g. it doesn't exist in Jython.

steve at orac:~/python$ jython
Jython 2.5.1+ (Release_2_5_1, Aug 4 2010, 07:18:19)
[OpenJDK Server VM (Sun Microsystems Inc.)] on java1.6.0_31
Type "help", "copyright", "credits" or "license" for more information.
>>> __builtins__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name '__builtins__' is not defined

You should use `__builtin__` in Python 2 and `builtins` in Python 3. *Anything* you do to `__builtins__` with an S is implementation-dependent.


I don't think it is a bug that CPython behaves differently regarding __builtins__ depending on whether IDLE is running or not.

----------
nosy: +steven.daprano

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


More information about the Python-bugs-list mailing list