what gives with "'import *' not allowed with 'from .'"?

D

Darren Dale

I know the use of "from foo import *" is discouraged, but I'm writing
a package that I hope others may want to integrate as a subpackage of
their own projects, I know what I'm doing, and I want to use the
"from .bar import *" syntax internally. It works fine with python-2.6,
but with python-2.5 I get a SyntaxError: "'import *' not allowed with
'from .'" Judging from http://bugs.python.org/issue2400 , this issue
was fixed back in May 2008, but it is still present with python-2.5.4,
which was released in December. Why wont python-2.5 allow this kind of
import?
 
B

Benjamin Peterson

Darren Dale said:
Judging from http://bugs.python.org/issue2400 , this issue
was fixed back in May 2008, but it is still present with python-2.5.4,
which was released in December. Why wont python-2.5 allow this kind of
import?

Allowing that would be a new feature which is disallowed in bug fix releases
like 2.5.4.
 
D

Darren Dale

Allowing that would be a new feature which is disallowed in bug fix releases
like 2.5.4.

I was talking about the behavior after doing "from __future__ import
absolute_import". I've been developing on python-2.6 using
absolute_import for weeks, knowing that I could do "from __future__
import absolute import" on python-2.5. Now when I try to use
python-2.5 I cant import my package. What is the point of providing
absolute_import in __future__ if the api is completely different than
the implementation in future python versions? Its bizarre.
 
S

Steve Holden

Darren said:
I was talking about the behavior after doing "from __future__ import
absolute_import". I've been developing on python-2.6 using
absolute_import for weeks, knowing that I could do "from __future__
import absolute import" on python-2.5. Now when I try to use
python-2.5 I cant import my package. What is the point of providing
absolute_import in __future__ if the api is completely different than
the implementation in future python versions? Its bizarre.

I guess it must specify some alternate future ...

regards
Steve
 
B

Benjamin Peterson

Darren Dale said:
I was talking about the behavior after doing "from __future__ import
absolute_import". I've been developing on python-2.6 using
absolute_import for weeks, knowing that I could do "from __future__
import absolute import" on python-2.5. Now when I try to use
python-2.5 I cant import my package. What is the point of providing
absolute_import in __future__ if the api is completely different than
the implementation in future python versions? Its bizarre.

The API is not completely different. The 2.5 version of the feature just lacks
the ability to import with "*". It is still same in 2.6, but with the ability to
use "*".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top