Thanks to all for the answers!
:)
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano wrote:
On Tue, 06 Oct 2009 21:44:35 -0400, Dave Angel wrote:
I'm surprised to see you missed this. A module doesn't generally import
itself, but it's an easy mistake for a circular dependency to develop
among modules.
Circular imports are always a difficulty. That has
On Tue, 06 Oct 2009 21:44:35 -0400, Dave Angel wrote:
> I'm surprised to see you missed this. A module doesn't generally import
> itself, but it's an easy mistake for a circular dependency to develop
> among modules.
Circular imports are always a difficulty. That has nothing to do with
making m
Steven D'Aprano wrote:
On Tue, 06 Oct 2009 18:42:16 +0200, Diez B. Roggisch wrote:
The most common problem is that a file is used as module and as
executable at the same time.
Like this:
--- test.py ---
class Foo(object):
pass
if __name__ == "__main__":
import test
assert Foo
On Tue, 06 Oct 2009 17:01:41 -0700, Carl Banks wrote:
>> Why would a module need to import itself? Surely that's a very rare
>> occurrence -- I think I've used it twice, in 12 years or so. I don't
>> see why you need to disparage the idea of combining modules and scripts
>> in the one file because
On Oct 6, 3:56 pm, Steven D'Aprano
wrote:
> On Tue, 06 Oct 2009 18:42:16 +0200, Diez B. Roggisch wrote:
> > The most common problem is that a file is used as module and as
> > executable at the same time.
>
> > Like this:
>
> > --- test.py ---
>
> > class Foo(object):
> > pass
>
> > if __name_
On Tue, 06 Oct 2009 18:42:16 +0200, Diez B. Roggisch wrote:
> The most common problem is that a file is used as module and as
> executable at the same time.
>
> Like this:
>
> --- test.py ---
>
> class Foo(object):
> pass
>
>
> if __name__ == "__main__":
>import test
>assert Foo i
Ethan Furman wrote:
> Greetings!
>
> I'm working on a package with multiple modules (and possibly packages),
> and I would like to do it correctly. :)
>
> I have read of references to possible issues regarding a module being
> imported (and run) more than once, but I haven't been able to find
>
Greetings!
I'm working on a package with multiple modules (and possibly packages),
and I would like to do it correctly. :)
I have read of references to possible issues regarding a module being
imported (and run) more than once, but I haven't been able to find
actual examples of such failing