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?

  • TheNamlessGuy@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    2 days ago

    Both are indeed equally terrible, even if it is for different reasons.

    The one true choice is of course letting the programmer choose the main function in compile/interpretation-time.

    I.e. python main.py --start "main" would start by calling the main function in main.py

    • Dr. Moose@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 days ago

      Most contemporary python tools like flask or uvicorn do exactly this and require an explicit entry point