HiddenLayer555@lemmy.ml to Programmer Humor@programming.devEnglish · 2 months 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 · 2 months 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-22 months 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).
minus-squarenickwitha_k (he/him)@lemmy.sdf.orglinkfedilinkarrow-up2·2 months agoTIL. Thanks for that!
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!