Class changes in circular imports when __name__ == '__main__'

Dave Angel davea at ieee.org
Mon Sep 6 19:44:17 EDT 2010



On 2:59 PM, Carl Banks wrote:
> On Sep 5, 5:07 pm, Dave Angel<da... at ieee.org>  wrote:
>> On 2:59 PM, Carl Banks wrote:
>>> All of this gets a lot more complicated when packages are involved.
>> Perhaps a better answer would be to import __main__ from the second module.
> Then what if the module is imported from a different script?  It'll
> try to import __main__ but get a different script than expected.
>
>
Then the module needs to adjust its expectations.  The point is it 
should never try to import the script by name.

DaveA




More information about the Python-list mailing list