I'm learning about classes and design in Python, and I have a question of how to implement the following pattern:
I would like the class to initialise with some code, some of which I would like to be able to call later on via a function, e.g.:
class c:
def __init__(self):
print('1')
m()
def m(self):
print('2')
print('3')
I am after something like the above, but I cannot use m() in init as it will not have been declared at this point. Is there anyway of implementing this without having to use the same code twice?