A startup puzzle

Stephen Horne $$$$$$$$$$$$$$$$$ at $$$$$$$$$$$$$$$$$$$$.co.uk
Mon Sep 29 14:52:42 EDT 2003


On Mon, 29 Sep 2003 18:40:47 GMT, Michael Hudson <mwh at python.net>
wrote:

>Stephen Horne <$$$$$$$$$$$$$$$$$@$$$$$$$$$$$$$$$$$$$$.co.uk> writes:
>
>> On Mon, 29 Sep 2003 11:31:05 -0500, "Edward K. Ream"
>> <edreamleo at charter.net> wrote:
>> 
>> >Any ideas for a clean solution?  Thanks.
>> 
>> I am not sure that I understand what you are saying, but I'll make a
>> quick suggestion...
>> 
>> Perhaps 'app' can be a global variable within 'leoGlobals', but
>> assigned the value 'None' when the module is imported. Your
>> initialisation code can then reassign the variable at the appropriate
>> time.
>
>This wont work.
>
>--- a.py --- 
>a = None
>--- b.py ---
>import a
>a.a = 1
>--- c.py ---
>from a import a
>import b
>print a
>
>running c.py will print "None".  Names, objects and bindings, remember
>:-)

Oops - I didn't realise import worked like that.

Thanks.


-- 
Steve Horne

steve at ninereeds dot fsnet dot co dot uk




More information about the Python-list mailing list