Also, do y’all call main() in the if block or do you just put the code you want to run in the if block?

  • jacksilver@lemmy.world
    link
    fedilink
    arrow-up
    14
    ·
    1 month ago

    The point of the name==main logic is that it checks if that is the file that was invoked (like running python filename.py). If you just put a main() in the global scope it will be called either when the file is invoked or loaded (which can cause unintended consequences).