Let's say I have a class MyClass
... which has a data member x
class MyClass1 :
def __init__(self) :
self.x = 1
Also a method which does something with x
Should I pass self.x
as a parameter?
class MyClass2 :
def __init__(self) :
self.x = 1
def multiple_of_x(self, x) :
return x * 2
Or just use self.x
within the method?
class MyClass3 :
def __init__(self) :
self.x = 1
def multiple_of_x(self) :
return self.x * 2
I'm asking which is the more correct approach to object oriented programming?