On Feb 22, 9:20 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
> On Fri, 22 Feb 2008 19:11:01 -0800 (PST), icarus <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
>
>
>
> > But how do I get around it? How do I update and access a variable
> > anytime I want? Any easy-to-follow e
Another way to avoid using global variables is to return more than one
values from the function.
Here is an example that may help you to understand it:
def foo(a, b, c):
a += c
b += c
return a, b
a = 5
b = 10
c = 2
print a, b
a, b = foo(a, b, c)
print a, b
regards,
Subeen.
http://l
icarus wrote:
> 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
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 i