John Salerno wrote:
> Robert Kern wrote:
> 
>> What is ambiguous about A.B.D, A.E, and A.F.G? But if you like:
> 
> I guess maybe I was looking at it backwards. From the way it was worded, 
> I thought the only information we had to use was the structure A.B.C, 
> and then given a statement like:
> 
> from . import D
> 
> we just had to figure out for ourselves that this results in A.B.D, 
> instead of, for example, A.C.D, or any other possibility.
> 
> But I'm still a little confused about the use of the single or double 
> period. In this case:
> 
> from . import D                 # Imports A.B.D
> from .. import E                # Imports A.E
> 
> why do you need a single period in the first example, and a double in 
> the second, if they both are importing from A? If E is directly under A, 
> couldn't you just use a single period? And since D is nested twice 
> beneath A (i.e., in A, then in B), wouldn't you need two periods there 
> instead?

Remember that this is code in the A.B.C module. The first form looks for 
modules 
in the A.B package, that is, next to A.B.C . The second looks for modules in 
the 
A package, next to A.B .

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to