"Xah Lee" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> globe=0; > def myFun(): > globe=globe+1 > return globe > > apparently it can't be done like that. I thought it can probably be > done by prefixing the variable with some package context... You can do this: globe=0 def myFun(): global globe globe=globe+1 return globe The question you should ask yourself, however, is why you want to do this. Do you really want to tie your function to a single global variable? Are you sure you will never need more than one? For example, the function you've written represents a counter. Are you sure you will never need more than one such counter? -- http://mail.python.org/mailman/listinfo/python-list