Welcome

Welcome to my external memory and information on what I'm currently working on. Here you will find snippets of code, tricks and solutions I, or maybe you, may need to reference.

Feel free to comment your suggestions and any constructive criticisms that you may have.

Wednesday, 9 April 2014

Python Boilerplate

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.