Open in app
JOSHUA WEINSTEIN
48 Followers
About

Sign in

48 Followers
About
Open in app
Python: if __name__ == “__main__”
495
5

Fabio Motta

JOSHUA WEINSTEIN

JOSHUA WEINSTEIN

Jul 23, 2020·1 min read

Great article but also worth mentioning for packages you just use a whole file called __main__.py, and running with -m will have the same effect.

Written by

JOSHUA WEINSTEIN

Programmer, Artist, Published Author. I’m an engineer on a mission to write the fastest software in the world.

More from JOSHUA WEINSTEIN

Programmer, Artist, Published Author. I’m an engineer on a mission to write the fastest software in the world.

More From Medium

The incredible power of Python’s replace regex

JOSHUA WEINSTEIN in Python In Plain English

How to become famous on GitHub

JOSHUA WEINSTEIN in Data Driven Investor

Learning frameworks isn’t a replacement for learning to code

JOSHUA WEINSTEIN

4 Easy Tips for Using Threads and Mutexes in C++

JOSHUA WEINSTEIN in Better Programming

Copying Data 2000% Faster With Advanced Vector Extensions

JOSHUA WEINSTEIN in The Startup

Illustrating Code: The Art of Visual Learning

JOSHUA WEINSTEIN in The Startup

Make Python Hundreds of Times Faster With a C-Extension

JOSHUA WEINSTEIN in The Startup

Searching Gigabytes of Data Per Second With SIMD

JOSHUA WEINSTEIN in The Startup

About

Help

Legal

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store