How to set local variables in a method
jkraska at san.rr.com
Tue Jan 29 17:45:31 CET 2002
>I intend to set the variables a and b in the getvalues method.. Does
>anyone know how to do this??
> def calculate(self):
> a,b = 0,0
> z = # what to put here???
> print a + b
> def getvalues(self,z):
> z['a'] = 2
>>> def f(): print f.a
>>> f.a = 3
This really isn't the right way to go about things, though. Keep in mind
that this data is essentially "static", as in common to all instances of
the function, from wherever it's called.
More information about the Python-list