Global Variables

DD qyu2 at nortelnetworks.com
Wed May 7 11:06:36 EDT 2003


I have a question regarding the use of global variables in python.

Will the value of a global variable in the execute method of a class, revert
back to the original value prior to entering the method.

For example:

global variable x=10

Now we enter the execute method of a class
global x
now we modify x=20 in this method
return
Can we return x=20  outside of this method?  It appears x=10 always.  So the
global variable x in this method is not updated to reflect the fact it has
been changed in the method.  How do I return with the value x=20?

Thanks for any help.







More information about the Python-list mailing list