SyntaxError: 'import *' not allowed with 'from .'

Steven Bethard steven.bethard at gmail.com
Tue Jan 15 13:58:41 EST 2008


George Sakkis wrote:
> Unless I missed it, PEP 328 doesn't mention anything about this.
> What's the reason for not allowing "from .relative.module import *' ?

Generally, there's a move away from all "import *" versions these days. 
For example, Python 3.0 removes the ability to use "import *" within a 
function:

     http://www.python.org/dev/peps/pep-3100/

I suspect the "import *" version is not enabled for relative imports 
because most of python-dev is against "import *" forms anywhere.

STeVe



More information about the Python-list mailing list