there's main() in python ONLY IF YOU WANT THERE TO BE.
the way you want it to be is as follows:
import foo
from baz import bar
do_stupid_stuff()
def main():
print("I am not kidding")
if ___name___ == '___main___':
main()
if ____name____ wasn't ____main___ then your script knows oh I'm not __main__, uh might as well uh evaluate the true path of this if clause I guess, else whatever. This is very robust and safe way to define the entrypoint.
27
u/Candid_Highlight_116 2d ago
there's main() in python ONLY IF YOU WANT THERE TO BE.
the way you want it to be is as follows:
if ____name____ wasn't ____main___ then your script knows oh I'm not __main__, uh might as well uh evaluate the true path of this if clause I guess, else whatever. This is very robust and safe way to define the entrypoint.