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/2002-April/023332.html below:

[Python-Dev] Importing top-level modules

[Python-Dev] Importing top-level modules [Python-Dev] Importing top-level modulesGuido van Rossum guido@python.org
Tue, 16 Apr 2002 18:37:07 -0400
> I had a problem yesterday where I wanted to extend a top-level module
> by a module in a subpackage. I naively named my module the same as the
> toplevel module, and peer import bit me. I finally had to rename my
> module for no good reason to get things working.

You did the right thing, for a good reason.

> So my question is: is there an easy way to force a top-level import
> (adress the top-level namespace), that I overlooked?

No.

> If not, what do you think of a 
> 
> 	from __top__ import systemmodule
> 
> similar to from __future__ ...
> 
> An alternative syntax would be "import .systemmodule", but that seems
> obscure.

I'm not keen on this.  I'd rather deprecate relative imports -- they
cause more trouble than they're worth.

--Guido van Rossum (home page: http://www.python.org/~guido/)




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