What is __name__ for in Python



What is __name__ for in Python

What is name for in Python


Video description

What is the if __name__ condition in Python for?

If you've seen __main__ at the end of a Python script and wondered why that is there it is to avoid side effects when importing and allowing you to run the file as a script on the terminal. If you want more details, watch this short video where we work with a Python script to find out those side effects and how the Python script can change once the if condition with __name__ is done at the end.

Next …

Start your Free Trial

Self paced

Go to the Course
We have partnered with providers to bring you collection of courses, When you buy through links on our site, we may earn an affiliate commission from provider.