[Python-Dev] Re: Python-Dev Digest, Vol 5, Issue 57

Edward Loper edloper at gradient.cis.upenn.edu
Tue Dec 16 15:17:49 EST 2003


Guido said:
> There is the remaining issue of what exactly the syntax would be.  I
> propose to extend the from clause to allow one or more dots before the
> dotted name, and to make the dotted name optional if at least one
> leading dot is found.  I propose not to change from-less import.

What's the motivation for restricting it to from-imports?  I suspect 
that this will cause confusion, and it doesn't feel self-consistent to 
me: why can you call a module ".foo" in one context, and not in 
another?  In particular, I think that if people see that you can do:

     from .foo import *

Then they'll assume that they can also do:

     import .foo

With the obvious semantics, i.e. equivalence to:

     from . import foo

What do we gain by not extending the syntax to from-less imports?

-Edward




More information about the Python-Dev mailing list