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*
In article <[EMAIL PROTECTED]>,
Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
> Set __name__ to 'subtest' as it would be if you had really imported
> subtest and the import system will correctly name the modules, causing
> imptest to be imported only once.
Ach. I get it now.
--
http://mail.py
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
Peter Maas wrote:
> The docs tell us
> (http://www.python.org/doc/2.4.2/lib/built-in-funcs.html):
>
> - begin ---
> execfile(filename[, globals[, locals]])
>
> This function is similar to the exec statement, but parses a file
> instead of a str
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
Michael Abbott wrote:
> In article <[EMAIL PROTECTED]>,
> Michael Abbott <[EMAIL PROTECTED]> wrote:
>
>> --- test.py ---
>> import imptest
>> execfile('subtest.py', dict(__name__ = 'subtest.py'))
>> --- imptest.py ---
>> print 'Imptest imported'
>> --- subtest.py ---
>> import imptest
>> ---
>>
>
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
On Fri, 30 Jun 2006 19:13:00 +0100, Michael Abbott <[EMAIL PROTECTED]> wrote:
>Bump
>
>In article <[EMAIL PROTECTED]>,
> Michael Abbott <[EMAIL PROTECTED]> wrote:
>
>> --- test.py ---
>> import imptest
>> execfile('subtest.py', dict(__name__ = 'subtest.py'))
>> --- imptest.py ---
>> print 'Imptest
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
Bump
In article <[EMAIL PROTECTED]>,
Michael Abbott <[EMAIL PROTECTED]> wrote:
> --- test.py ---
> import imptest
> execfile('subtest.py', dict(__name__ = 'subtest.py'))
> --- imptest.py ---
> print 'Imptest imported'
> --- subtest.py ---
> import imptest
> ---
>
>$ python test.py
>Impt
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 ---
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
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 ---
import imptest
execfile('subtest.py',
13 matches
Mail list logo