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/2004-May/044701.html below:

[Python-Dev] PEP 328: import...as with relative import

[Python-Dev] PEP 328: import...as with relative import [Python-Dev] PEP 328: import...as with relative importGuido van Rossum guido at python.org
Thu May 6 10:04:33 EDT 2004
> There's been some discussion on c.l.py about whether the
> new relative import system should allow things like
> 
>   import ..abc as def
> 
> It seems the PEP currently disallows this, but nobody
> seems to be able to adequately explain why. Is there
> any technical reason it couldn't be done?

Because "import ..abc" is clearly nonsense, since after "import X" you
should be able to the imported entity as "X" in your program, and
"..abc" is not a valid expression.

This doesn't strictly apply to "import ..abc as xyz" ("def" was a poor
choice for "X" :-), but it doesn't seem worth stretching the syntax
when you can already do that using "from .. import abc as xyz".

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

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