Re: Module executed twice when imported!

2006-07-01 Thread Georg Brandl
Michael Abbott wrote: > In article <[EMAIL PROTECTED]>, > Georg Brandl <[EMAIL PROTECTED]> wrote: >> That's because __name__ is normally set to the module's name in the package >> hierarchy. When you set it to "some1.some2", Python thinks it's >> in a subpackage > > A. > > So what I *should*

Re: Module executed twice when imported!

2006-06-30 Thread Michael Abbott
In article <[EMAIL PROTECTED]>, Georg Brandl <[EMAIL PROTECTED]> wrote: > That's because __name__ is normally set to the module's name in the package > hierarchy. When you set it to "some1.some2", Python thinks it's > in a subpackage A. So what I *should* have set it to is the module name *w

Re: Module executed twice when imported!

2006-06-30 Thread Georg Brandl
Michael Abbott wrote: > In article <[EMAIL PROTECTED]>, > John Salerno <[EMAIL PROTECTED]> wrote: > >> > (http://docs.python.org/lib/built-in-funcs.html#l2h-24) >> > "It is different from the import statement in that it does not use the >> > module administration --" >> >> Just after the above s

Re: Module executed twice when imported!

2006-06-30 Thread Michael Abbott
In article <[EMAIL PROTECTED]>, John Salerno <[EMAIL PROTECTED]> wrote: > > (http://docs.python.org/lib/built-in-funcs.html#l2h-24) > > "It is different from the import statement in that it does not use the > > module administration --" > > Just after the above statement, it also says: > > "it

Re: Module executed twice when imported!

2006-06-30 Thread John Salerno
Simon Forman wrote: > I don't get it either but there may be a clue in the docs for the > execfile() function > (http://docs.python.org/lib/built-in-funcs.html#l2h-24) > > "It is different from the import statement in that it does not use the > module administration --" Just after the above stat

Re: Module executed twice when imported!

2006-06-28 Thread Bruno Desthuilliers
Michael Abbott a écrit : > It seems to be an invariant of Python (insofar as Python has invariants) > that a module is executed at most once in a Python session. I have a > rather bizzare example that breaks this invariant: can anyone enlighten > me as to what is going on? > > --- test.py ---

Re: Module executed twice when imported!

2006-06-28 Thread Simon Forman
Michael Abbott wrote: > It seems to be an invariant of Python (insofar as Python has invariants) > that a module is executed at most once in a Python session. I have a > rather bizzare example that breaks this invariant: can anyone enlighten > me as to what is going on? > > --- test.py --- > impor