For example, consider the following class:
class A:
def __init__(self):
self.attr1 = value
self.attr2 = self.foo()
def foo(self):
return self.attr1 ** 2
Is this the right way, should I pass attr1
to foo
as a parameter or should I define foo
outside the class?