Relative-importing *

Alex Popescu nospam.themindstorm at gmail.com
Fri Jul 27 19:29:32 EDT 2007


Ben Finney <bignose+hates-spam at benfinney.id.au> wrote in 
news:871weth2gg.fsf at benfinney.id.au:

> rbygscrsepda at gmail.com writes:
> 
>>     from . import *
>>     from .sibiling import *
>>     from .. import *
>>     from ..parent_sibling import *
>> 
>> ...and so on. The same error occurs:
>>     SyntaxError: 'import *' not allowed with 'from .'
> 
> Interesting. I know that 'from foo import *' is frowned on and is
> generally worse than importing names explicitly, but I wasn't aware
> that it was officialy deprecated. The PEP introducing absolute and
> relative imports <URL:http://www.python.org/dev/peps/pep-0328/>
> doesn't mention it, except as a friendly "import * is *not* an option
>:-)" aside.
> 

Well, I may be looking it from the wrong perspective but what is the 
meaning of :

from . import *
from .. import **

Import all modules available at that relative path?

I am not sure why the other 2 versions are not working, though.

./alex
--
.w( the_mindstorm )p.




More information about the Python-list mailing list