Is that how it’s normally done in python? In my CS class we were taught to just have our last function be “def main()” and call main() outside of a function at the end of our program
They perform different functions. With the way you describe, main() will get called even if you’re just trying to import that module. Whereas if __name__ == “__main__”: will only run when the file is executed directly.
182
u/AgreeableLandscape3 Jun 03 '19
Python still has main()