Daily Archives: February 16, 2016

Why Python programs often have this: `if __name__ == “__main__”:`

If you were wondering why Python programs often have this: `if __name__ == “__main__”:` and then a call to a function, a good explanation is here.

In short, if your program is used as input to other programs, then you want to have that snippet of code in them. If your programs are standalone, you can get by without it.