Xah Lee wrote:
globe=0; def myFun(): globe=globe+1 return globe
The short answer is to use the global statement:
globe=0 def myFun(): global globe globe=globe+1 return globe
more elegant is:
globe=0 globe=myfun(globe) def myFun(var): return var+1
and still more elegant is using classes and class attributes instead of global variables.
-pu -- http://mail.python.org/mailman/listinfo/python-list