[issue25564] Document that IDLE -python difference for `del __builtins__`

Steven D'Aprano report at bugs.python.org
Wed Aug 24 21:50:48 EDT 2016


Steven D'Aprano added the comment:

Terry J. Reedy added the comment:
> Steven: "You should use `__builtin__` in Python 2 and `builtins` in 
> Python 3."  I presume this is for import statements.

My understanding is that __builtins__ is intended to be for the private 
use of the CPython interpreter only. It may not be available in other 
Pythons, or in the future, and code that needs access to the built-ins 
should treat it as a regular module and import it via __builtin__ in 
Python 2 and builtins in Python 3.

In other words, unless you're the CPython interpreter, don't touch 
__builtins__.

I don't know whether IDLE is considered sufficiently closely integrated 
to CPython that it is allowed to rely on __builtins__, but for an 
ordinary module (even one in the stdlib) I wouldn't touch it at all.

----------
title: Document IDLE -python difference for `del __builtins__` -> Document that IDLE -python difference for `del __builtins__`

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


More information about the Python-bugs-list mailing list