The contrast between variables declared to be global and other variables is seen in two functions here.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
def FunctionOne(r):
  global T
  T = -1
  return r+T

def FunctionTwo(r):
  T = -1
  return r+T

T = 0
print FunctionOne(5)
print T
T = 0
print FunctionTwo(5)
print T

Output when running this code consists of these four lines:

4
-1
4
0

Thus, FunctionTwo does not change variable T in the code of lines 10-15, even though there is an assignment to T on line 7 within FunctionTwo. The reason is that Python considers T, within the body of FunctionTwo, to be a local variable of the function (which ceases to exist after FunctionTwo returns from a call).