How to change globale variables? Hehlp!!

Alex Martelli aleaxit at yahoo.com
Thu Nov 9 20:53:43 CET 2000


<etsang at my-deja.com> wrote in message news:8uesb5$920$1 at nnrp1.deja.com...
> Hi,
>
> Ihave the following situation:
> Those globale variables are file name.
>               global variables defined in  file A:
>                            |
>                            |
>                            |
>        file B uses A             file C uses A

By "uses", I assume you mean
    import A
right?

>        file B needs to change global variables defined in A

So the code in file B writes
    A.somevar = 23
or whatever.

>        this change to be reflected in all three files.

It will be.

>        file B will not know the change until at some point in runtime.
>        those functions in file A and file C will not use trcfile until
> file B is run

What's 'trcfile'?


> Is there a way that file B can chnage the global variable in file A and
> reflect these chnage simulatanouesly to all three files??

The question, as posed, appears utterly simple -- indeed, I
wouldn't know how to AVOID "reflecting" whatever change
"simultaneously"...!  Are there perchance multiple threads
around, that you're not telling us about...?


Alex






More information about the Python-list mailing list