Redirecting to python-ideas.

On Thu, Apr 4, 2013 at 9:26 AM, Richard Oudkerk <shibt...@gmail.com> wrote:
> On 04/04/2013 4:17pm, Guido van Rossum wrote:
>>
>> I don't really see what we could change to avoid breaking code in any
>> particular case -- the burden is up to the library to do it right. I
>> don't see a reason to forbid any of this either.
>
>
> How about having a form of relative import which only works for submodules.
> For instance, instead of
>
>     from . import moduleX
>
> write
>
>     import .moduleX
>
> which is currently a SyntaxError.  I think this could be implemented as
>
>     moduleX = importlib.import_module('.moduleX', __package__)

We considered that when relative import was designed and rejected it,
because it violates the expectation that after "import <some string>"
you can use exactly "<some string>" in your code.

--
--Guido van Rossum (python.org/~guido)
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to