global variables: to be or not to be

icarus rsarpi at gmail.com
Fri Feb 22 22:11:01 EST 2008


I've read 'global variables' are bad.  The ones that are defined as
'global' inside a function/method.

The argument that pops up every now and then is that they are hard to
keep track of.  I don't know Python well enough to argue with that.
Just started learning it a few days ago, so I won't get into
philosophical questions such as "why this? Why not that?".  I'll take
it as it is, just like I take 1 + 1 = 2 for granted.

So..."global variables taste bad.  Avoid them."

But how do I get around it? How do I update and access a variable
anytime I want? Any easy-to-follow examples? Thanks in advance.











More information about the Python-list mailing list