I have come across examples where people used a Main class, and from there, inside the Main class, write logic that instantiates other classes and calls their functions.
Example:
# ^^^ code containing class OtherClass() ^^^
class Main:
def __init__(self):
print("\n **** Main class from which we call other classes **** \n")
other_object = OtherClass()
self.plot_graphs(other_object)
def plot_graphs(self, other_object):
# plot stuff
pass
# vvv code containing main code which instantiates main = Main() vvv
Upon implementing this, I see warnings that all of my methods/functions in the Main class (like plot_graphs) are/should be static. In that sense, why have a Main class at all if you could just as well take out those functions outside of the Main?
I know that there are workarounds like adding a decorator like @staticmethod or a macro like #noinspection PyMethodMayBeStatic. But this got me wondering whether it is Pythonic at all to have a Main class if you don't alter it's attributes, or not.