python your_script.pyall of the code that is at indentation level 0 gets executed and functions and classes that are defined but none of their code gets ran. If will then read :
so it will execute the block standalone. In other words, when you use the __main__ this means the module is being run standalone
if __name__ == '__main__'
if __name__ == '__main__': print '... is being run by itself' else: print '... is being run directly'