Tuesday, January 09, 2007

Static variables in python

ints are not modifiable, so += actually rebinds the variable.  Try:

def_f():
global global_var_c_hits
global_var_c_hits +=1

No comments: