Let's say I have the following class:
class A():
def fn1(self):
pass
def fn2(self):
pass
Now I would want to call function fn3
inside both fn1
and fn2
. The function fn3
should be such a way that only fn1
and fn2
should be able to call it(because fn3
would be only required by fn1
or fn2
).
My Approach would be,
class A():
def fn3(self):
pass
def fn1(self):
fn3()
pass
def fn2(self):
fn3()
pass
Here I see the drawback that fn3
should have argument self
(In my case fn3
does not make use of it). One more drawback would be fn3
can be called by other objects declared outside the class, which is not necessary.