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?

  • nickwitha_k (he/him)@lemmy.sdf.org
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    2 days ago

    This is exactly why the conditional is used. It allows the script to function both as a standalone application and a library.

    ETA: Probably would make sense to just treat it as default behavior in the interpreter and only require the conditional to overwrite in cases where main is not the main function and/or pre-processing is needed.