can a method access/set another's variables?

asdf1234234 wswilson at
Sun Apr 1 21:36:04 EDT 2007

My code is:
import b

class A:
     def __init__(self):
     def my_method(self):
          var = 1
          self.var = 2
          print var
          print self.var

my_a = A()
def set_var(self):
     var = 2
     self.var = 2

I want both var and self.var to be 2 at the end. Is there anything I
can pass to set_var() that will give it access to the variables in
my_method() like I can use self for the variables in the class A?

More information about the Python-list mailing list