Global variables for python applications

Krister Svanlund krister.svanlund at gmail.com
Sun May 16 14:00:46 EDT 2010


On Sun, May 16, 2010 at 7:50 PM, AON LAZIO <aonlazio at gmail.com> wrote:
> Hi,
>    How can I set up global variables for the entire python applications?
> Like I can call and set this variables in any .py files.
>    Think of it as a global variable in a single .py file but this is for the
> entire application.
>    Thanks
>
> --
> Aonlazio
> 'Peace is always the way.' NW

First: Do NOT use global variables, it is bad practice and will
eventually give you loads of s**t.

But if you want to create global variables in python I do believe it
is possible to specify them in a .py file and then simply import it as
a module in your application. If you change one value in a module the
change will be available in all places you imported that module in.



More information about the Python-list mailing list