class A():
def __init__(self):
self.x = 3
@staticmethod
def f(x):
return x ** 2
def g(self):
return self.x ** 2
def run(self):
self.f(self.x)
def run2(self):
self.g()
Which one is more preferable, run() or run2? The former pass explicitly the instance variable self.x to the function f; the latter does not.
Thank you.
g, becauserun2isn't returning anythingg. the rest are obfuscating state for no obvious benefit