local and global vars

How to defin vars global to change them in classes and def??

if i defin x and y coords and wants to change them in an class they say

UnboundLocaError: local varibal ‘z’ refernced before assignment

Please help

And if it is possibly how to convert boal to int?

variable= 0 #a global variable
class Foo:
  def func(self, par):
    global variable
    print "Variable is set to ", variable
    variable= variable + 1

Python have boolean operations

b= True
b= False

this is working:

v= 0
b= True
v+= 1
print v # 1
v+= b
print v # 2
b= False
v+= b
print v # 2

Martin