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 <rep...@bugs.python.org>
<https://bugs.python.org/issue25564>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to