[pypy-dev] replacing/modifying __import__

Armin Rigo arigo at tunes.org
Mon Feb 13 15:50:45 CET 2012


Hi Timothy,

On Mon, Feb 13, 2012 at 15:18, Timothy Baldridge <tbaldridge at gmail.com> wrote:
> Now in CPython I can simply ovewrite __builtins__.__import__ with a
> new function that adds additional functionality to __import__.
> However, in PyPy we can't change __builtins__.

Why not?

You're probably just confused about __builtin__ versus __builtins__.
Don't use the latter, even in CPython, because it only works half of
the time.  It is documented as an internal detail.  Always do "import
__builtin__" instead.


A bientôt,

Armin.


More information about the pypy-dev mailing list