Patrick Useldinger wrote:
Kent Johnson wrote:

globe=0
globe=myfun(globe)
def myFun(var):
  return var+1



This mystifies me. What is myfun()? What is var intended to be?


myfun is an error ;-) should be myFun, of course.

var is parameter of function myFun. If you call myFun with variable globe, all references to var will be replaced by globe inside function myFun.

Oh. I thought there was some deep magic here that I was missing :-)

You also have to define myFun before you call it...

def myFun(var):
  return var+1

globe = 0
...
globe = myFun(globe)

Kent
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to