If __name__ == "__main__" (with animations) Python Tutorial

Опубликовано: 04 Июнь 2019
на канале: PyMoondra
6,997
227

In this video we will look at the
ubiquitous yet mysterious line of code, If _name_ == "__main__" that pops up in many Python scripts. When I first started, I was wondering why we use _name_ == _main__. If __name_ == "__main__" is actually a way to check if your script is a script or module. If you don't understand that, don't worry, everything is explained in the video.
In this video, we will learn with clear examples why we use if _name_ == "__main__", what each of the components (__name__) and _main_ mean,
I give clear examples with animations to show what this line means,
as well as how to and when to use it and you should hopefully leave this video with a full grasp of the meaning behind the mysterious statment:

if _name_ == "__main__"

You can find the notebook here in my Python stuff repository (or can be found eventually):

https://github.com/moondra2017/Python...