Monica Shiralkar wrote:I read that in Python main method is optional. Even in Java, main is not required if the class is a POJO. Is main not being mandatory in python any different from the case of java where it is not required in case of POJOs?
POJO has nothing to do with it. Any Java class can have a main method. Granted, a class isn't operating as a POJO when it's executing a main method, but a main method can always instantiate its class and operate the instance as a POJO. Such things have been done for
testing purposes, for example.
On the other hand, the concept of a main method doesn't exist in Python. Python just takes whatever Python file you point it at and starts executing top-to-bottom. The conventions I've mentioned earlier are merely conventions. A Python file need not declare any methods, functions, or classes.
Some people, when well-known sources tell them that fire will burn them, don't put their hands in the fire.
Some people, being skeptical, will put their hands in the fire, get burned, and learn not to put their hands in the fire.
And some people, believing that they know better than well-known sources, will claim it's a lie, put their hands in the fire, and continue to scream it's a lie even as their hands burn down to charred stumps.