modifing function's parameters global value

David Broadwell anti-spam.dbroadwell at mindspring.com
Tue May 13 15:22:14 EDT 2003


"Federico" <maschio_77 at hotmail.com> wrote in message
> How can I modify the global value of function's parameters

Here is the code:

x=1
def func(y):
    y=y+1
    print y
    return y
print x
x = func(x)
print x

the x = line re-assigns x from 1 to the value returned by func() of 2 ...

There you go, modified the global value ...

--

David Broadwell






More information about the Python-list mailing list