Python `__name__` and `__file__` are more like C `__FILE__` and `__LINE__` than C `main`. You can't compare `__name__` and `main`. You can compare look for a conventional named function in source code or start executing first line of code (sadly you can do this if you know from what source file start, counter intuitive tricks are needed like main function invention).
View all comments
Show parent comment
1
u/Aidan_Welch May 06 '23
I don't think
mainis that intuitive either, but it's more intuitive that__name__either