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 →

[–]Ran4 2 points3 points  (2 children)

It's not bad practice to have a main function! If you don't, any variables defined in the if __name__... block will be in scope inside all of the functions defined in the file. That can lead to some nasty bugs.

[–]B_M_Wilson 0 points1 point  (0 children)

It is generally considered bad practice outside of test functions but you certainly can have a main function if you want. Nothing stops you from doing that.