Having a bit of a problem with getting my head around how Python handles global variables.
----Python Code----
#!/usr/bin/env python
global SOMEVAR
SOMEVAR = "Hello"
def FNsomefunction():
SOMEVAR = "Goodbye"
print SOMEVAR
FNsomefunction()
print SOMEVAR
----End of Python Code----
When this is run, the output is Hello twice.
Now, to my brain since SOMEVAR is a global variable, the contents should be accessible from any part of the code, and should be changeable from any part of the code too.
Am I thinking about, or implementing this in completely the wrong way?
Cheers.
Grant. :)