Re: Relative-importing *

2007-08-06 Thread Steve Holden
Marc 'BlackJack' Rintsch wrote: > On Tue, 07 Aug 2007 02:45:23 +, rbygscrsepda wrote: > >> Specifically, in Python 1.5, all of the following generate the error >> below: > > In Python *1.5*!? I somehow doubt that. ;-) > >> from . import * >> from .sibiling_package import * >> f

Re: Relative-importing *

2007-08-06 Thread Marc 'BlackJack' Rintsch
On Tue, 07 Aug 2007 02:45:23 +, rbygscrsepda wrote: > Specifically, in Python 1.5, all of the following generate the error > below: In Python *1.5*!? I somehow doubt that. ;-) > from . import * > from .sibiling_package import * > from .. import * > from ..cousin_package imp

Re: Relative-importing *

2007-08-06 Thread Steve Holden
[EMAIL PROTECTED] wrote: > On Aug 6, 12:19 am, Ben Finney <[EMAIL PROTECTED]> > wrote: >> [EMAIL PROTECTED] writes: >>> (In addition, it probably would make the program somewhat slower to >>> have an internal class inside every module, and performance is >>> important to me, as I'm planning to use

Re: Relative-importing *

2007-08-06 Thread rbygscrsepda
On Aug 6, 12:19 am, Ben Finney <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] writes: > > (In addition, it probably would make the program somewhat slower to > > have an internal class inside every module, and performance is > > important to me, as I'm planning to use this project in a future > > g

Re: Relative-importing *

2007-08-06 Thread Ben Finney
[EMAIL PROTECTED] writes: > (In addition, it probably would make the program somewhat slower to > have an internal class inside every module, and performance is > important to me, as I'm planning to use this project in a future > game. This is known as "premature optimisation", and it's harmful.

Re: Relative-importing *

2007-08-05 Thread rbysamppi
On Aug 4, 7:10 am, Ben Finney <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] writes: > > Yes, I'mimporting* for a reason, a good one, I think. > > Reading your description, I must say I don't see a good reason. > > > I have a set of modules (the number planned to reach about 400) that > > would be

Re: Relative-importing *

2007-08-04 Thread Ben Finney
[EMAIL PROTECTED] writes: > Yes, I'm importing * for a reason, a good one, I think. Reading your description, I must say I don't see a good reason. > I have a set of modules (the number planned to reach about 400) that > would be dynamically loaded by my program as needed, and they're > somewhat

Re: Relative-importing *

2007-08-03 Thread rbygscrsepda
Thanks to everybody for replying. (I apologize for the delayed response: my connection's been down for a week.) Yes, I'm importing * for a reason, a good one, I think. I have a set of modules (the number planned to reach about 400) that would be dynamically loaded by my program as needed, and they

Re: Relative-importing *

2007-07-30 Thread Bruno Desthuilliers
Paul Rubin a écrit : > Steven D'Aprano <[EMAIL PROTECTED]> writes: > >>I read "from module import *" as explicitly saying "clobber the current >>namespace with whatever names module exports". That's what from does: it >>imports names into the current namespace. It isn't some sort of easy to >>miss

Re: Relative-importing *

2007-07-30 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : (snip) > I do take your point that importing * has the potential to unexpectedly > clobber names you didn't intend, Another problem is that it makes harder to know from which module a name comes from. > and that's a good reason to avoid it > unless you have a good reaso

Re: Relative-importing *

2007-07-28 Thread Ben Finney
Paul Rubin writes: > Steven D'Aprano <[EMAIL PROTECTED]> writes: > > I read "from module import *" as explicitly saying "clobber the > > current namespace with whatever names module exports". That's what > > from does: it imports names into the current namespace. It isn'

Re: Relative-importing *

2007-07-28 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > I read "from module import *" as explicitly saying "clobber the current > namespace with whatever names module exports". That's what from does: it > imports names into the current namespace. It isn't some sort of easy to > miss side-effect. If a name al

Re: Relative-importing *

2007-07-27 Thread Steven D'Aprano
On Sat, 28 Jul 2007 09:05:51 +1000, Ben Finney wrote: > [EMAIL PROTECTED] 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

Re: Relative-importing *

2007-07-27 Thread Alex Popescu
Ben Finney <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > [EMAIL PROTECTED] writes: > >> from . import * >> from .sibiling import * >> from .. import * >> from ..parent_sibling import * >> >> ...and so on. The same error occurs: >> SyntaxError: 'import *' not allowed

Re: Relative-importing *

2007-07-27 Thread Ben Finney
[EMAIL PROTECTED] 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 an

Relative-importing *

2007-07-27 Thread rbygscrsepda
Hi, I'm a newbie at Python. :) Right now it's not letting me import * from any relative package name--i.e., a name that starts with a dot. For instance, none of the following work: from . import * from .sibiling import * from .. import * from ..parent_sibling import * ...and so on