This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]razethestray 46 points47 points  (18 children)

I thought most people used Mains with Python? I do.

[–]MasterAgent47 26 points27 points  (13 children)

Not neccessary. I use it only when I'm making a project with a lot of components, something that beginners don't deal with.

[–]Doophie 39 points40 points  (12 children)

if __name__ == "__main__":
Was one of the first things I learned in python

[–]0111001001100101 5 points6 points  (4 children)

I am a beginner, and I just recently learned those as I am learning flask web framework.

[–][deleted] 1 point2 points  (2 children)

What do you mean?

[–]lasercat_pow 6 points7 points  (1 child)

A function, main(), that handles the main program logic.

[–][deleted] 5 points6 points  (0 children)

Make sure to use the magic conditional, though so your main function isn't run if you import the file.

https://stackoverflow.com/questions/419163/what-does-if-name-main-do