What is it?
Basically, what it does is allow you to make your code modular by allowing you to put your execution code into a main function which is run when the file itself is run by the Python Interpreter. This means that you can then import this file in another without executing main code in order to make use of its methods.
The Code
The important part of the template is the final two lines. The call to main() will only be executed if this file was invoked by the Python interpreter.
No comments :
Post a Comment