HiddenLayer555@lemmy.ml to Programmer Humor@programming.devEnglish · 1 month agoPython needs an actual default functionlemmy.mlimagemessage-square160linkfedilinkarrow-up1761arrow-down129file-text
arrow-up1732arrow-down1imagePython needs an actual default functionlemmy.mlHiddenLayer555@lemmy.ml to Programmer Humor@programming.devEnglish · 1 month agomessage-square160linkfedilinkfile-text
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?
minus-squarelmmarsano@lemmynsfw.comlinkfedilinkEnglisharrow-up6·edit-21 month agoAlternative: put entry point code in file __main__.py & run the containing package (eg, some_package) as a top-level expression (eg, python -m some_package).
Alternative: put entry point code in file
__main__.py
& run the containing package (eg,some_package
) as a top-level expression (eg,python -m some_package
).TIL. Thanks for that!