Nick Coghlan wrote:

Michael Hoffman wrote:

raver2046 wrote:

How to have a global var in python ?

"global var" will give you a global variable named "var".

Whether this advice is correct or not depends greatly on what the OP means by 'global' :)


Module global, it's right, application global it's wrong. Given the nature of the question, I suspect the latter.

And even there, one must be careful. "global var" won't really give you a global variable; it will cause the name "var", when used locally, to refer to a pre-existing module-level reference "var". No variables are actually created in the execution of "global var".


Jeff Shannon
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to