I have a class which has two methods(m_1 and m_2). The method m_1 makes a call to method m_2. Now i want to make sure that only m_1 can be called using a class insance and not m_2. How can i do that ?
class C_1:
def m_1(self,z) :
np.square(z)
def m_2(self,x) :
y = m_1(x)
out = log(y)
ret(out)
I want only m_2 to be callable i.e
C_1.m_2(x) # Valid
C_1.m_1(z) # m_1 shouldn't be allowed to call directly from the class instance
I know that the example here might not seem right as i can get square and log operation in a single method but, I am just using this simple example to formally put down what i expect to be done in the code.