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

[Python-Dev] Re: PEP 328 -- relative and multi-line import

[Python-Dev] Re: PEP 328 -- relative and multi-line import [Python-Dev] Re: PEP 328 -- relative and multi-line importGuido van Rossum guido at python.org
Sat Apr 3 11:57:59 EST 2004
> Good point.  Here's what I *think* the semantics are; as soon as I get
> agreement, I'll update the PEP.  Given a package layout::
> 
>     package
>         subpackage1
>             moduleX
>             moduleY
>         subpackage2
>             moduleZ
>         moduleA
> 
> Each leading "." refers to one level of parent.  Assuming that the
> current file is ``moduleX.py``, following are correct usages of the new
> syntax::
> 
>     from .moduleY import spam
>     from ..subpackage1 import moduleY
>     from ..subpackage2.moduleZ import eggs
>     from ..moduleA import foo
>     from ...package import bar
> 
> Actually, I believe that this is the only possible useful semantic; I
> would welcome clear reasoning for another semantic.

All correct.

> Here's a question.  Should the following be legal? ::
> 
>     from ...sys import path
> 
> If not, do we test for it?  What kind of error do we raise?

Legal but insane.  Not an error.

--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