Python 2.6 Global Variables

Fabio Zadrozny fabiofz at gmail.com
Thu Nov 5 09:45:31 EST 2009


On Wed, Oct 28, 2009 at 10:50 PM, mattofak <mattofak at gmail.com> wrote:
> Hi All;
>
> I'm new to Python and moving from C, which is probably a big source of
> my confusion. I'm struggling with something right now though and I
> hope you all can help.
>
> I have a global configuration that I would like all my classes and
> modules to be able to access. What is the correct way to do this?
>
> Thanks;
> Matthew Walker
> --
> http://mail.python.org/mailman/listinfo/python-list
>


I'd usually use the singleton pattern in this case (or you can just
create a class and put things in the class -- and just as a note, I'd
try to avoid declaring anything as global unless really needed).

Cheers,

Fabio



More information about the Python-list mailing list