[New-bugs-announce] [issue15720] move __import__() out of the default lookup chain

Eric Snow report at bugs.python.org
Sat Aug 18 05:38:09 CEST 2012

New submission from Eric Snow:

When people want to import modules with "runtime" names, they regrettably turn to __import__(), have done so for many years, and likely will for a while.

If it were less convenient to use __import__(), fewer people would use it.  I'm putting together a patch that removes it from <module>.__builtins__, so that it will not be found during normal name lookup.  However, it will still available for the adventurous spirit via the imp module, following the precedent of reload().

This proposal came up in issue15715.

components: Interpreter Core
messages: 168493
nosy: brett.cannon, eric.snow
priority: normal
severity: normal
stage: needs patch
status: open
title: move __import__() out of the default lookup chain
type: behavior
versions: Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list