(I am trying to learn Python by myself and I am not a native english speaker.)
I need an advice. What is a usual way to pass a variable in OOP from one method to another? Is it better to make a variable an attribute of a instance, to make a helper 'get' function or something else?
1.
class A(object):
...
def a(self):
self.first = 32
second = input("Second:")
return self.first + second
def b(self):
return self.first + 1
..or
class A(object):
...
def get_first(self):
first = 32
return first
def a(self):
first = get_first()
second = input("Second:")
return first + second
def b(self):
return get_first() + 1
or is there some other usual way?