I understand the purpose of it, however I was wondering what is the most pythonic way to use if __name__ == '__main__'
?
I'm divided between putting all my code in a main()
function and calling it like:
if __name__ == '__main__':
main()
Or not bothering with that and just writing all top-level code there:
if __name__ == '__main__':
# all top-level code...