f



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

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?
0
dsdale24 (29)
1/23/2009 2:56:18 AM
comp.lang.python 77058 articles. 6 followers. Post Follow

5 Replies
930 Views

Similar Articles

[PageSpeed] 14

Darren Dale <dsdale24 <at> gmail.com> writes:
> 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. 




0
benjamin6260 (162)
1/23/2009 3:07:36 AM
On Jan 22, 10:07=A0pm, Benjamin Peterson <benja...@python.org> wrote:
> Darren Dale <dsdale24 <at> gmail.com> writes:
>
> > Judging fromhttp://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 relea=
ses
> 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.
0
dsdale24 (29)
1/23/2009 11:24:59 AM
Darren Dale wrote:
> On Jan 22, 10:07 pm, Benjamin Peterson <benja...@python.org> wrote:
>> Darren Dale <dsdale24 <at> gmail.com> writes:
>>
>>> Judging fromhttp://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.
> 
> 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
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/

0
steve73 (4801)
1/23/2009 1:23:46 PM
Darren Dale wrote:
> .... What is the point of providing absolute_import in __future__ if the
> api is completely different than the implementation in future python versions?

The point is to obtain user experience with a proposed feature _before_
you fix the interface and start having to be "backward compatible."

--Scott David Daniels
Scott.Daniels@Acm.Org
0
scott.daniels (1683)
1/23/2009 7:40:33 PM
Darren Dale <dsdale24 <at> gmail.com> writes:
> 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 "*".




0
benjamin6260 (162)
1/23/2009 8:28:13 PM
Reply: