Message273617
| Author |
steven.daprano |
| Recipients |
ppperry, steven.daprano, terry.reedy |
| Date |
2016年08月25日.01:50:48 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<20160825015039.GE26300@ando.pearwood.info> |
| In-reply-to |
<1472072691.69.0.782723468817.issue25564@psf.upfronthosting.co.za> |
| Content |
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. |
|