A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-July/101907.html below:

[Python-Dev] How to block a module import

[Python-Dev] How to block a module import [Python-Dev] How to block a module importAlexander Belopolsky alexander.belopolsky at gmail.com
Tue Jul 13 22:58:48 CEST 2010
On Tue, Jul 13, 2010 at 4:34 PM, Brett Cannon <brett at python.org> wrote:
..
> Nick's right; 0 fails on an import * to pull anything in of interest.

but if the imported module has

try:
   import blocked_module
except ImportError:
   do_something_important()

then import_fresh_module() will create a broken module with
do_something_important() not executed.

> And as
> I said on python-checkins -- you can ignore that email, Alexander

Too late.  I already replied. :-)

>-- there
> is a historical reason because in Python 2 if you tried an implicit relative
> import a value of None met to do an absolute import. This doesn't have that
> effect in py3k as explicit relative imports are the only way to do relative
> imports (and luckily importlib does the proper thing for this as well =).

Is there a problem with this change for 3.x?
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4