2.1.1 global weirds
Robin Becker
robin at jessikat.fsnet.co.uk
Sat Aug 11 09:30:26 EDT 2001
In article <9l35hb03081 at enews1.newsguy.com>, Alex Martelli
<aleaxit at yahoo.com> writes
>"Robin Becker" <robin at jessikat.fsnet.co.uk> wrote in message
>news:FkggeoAAfQd7Ewfb at jessikat.fsnet.co.uk...
> ...
>> why is b2.getStory not getStory? Is it because importing from a isn't
>> the same as the importing from the __main__ module?
>
>Exactly. You have two instances of the module, one referred
>to by sys.modules['__main__'] and the other by sys.modules['a'].
>
>
>> What is the correct way to import from the main script?
>
>import __main__
>
>
>Alex
not exactly good programming though if I later I import run from a in a
different main script.
Isn't this a wart?
--
Robin Becker
More information about the Python-list
mailing list