this post was submitted on 28 May 2025
42 points (92.0% liked)

Programming Humor

3159 readers
1 users here now

Related Communities !programmerhumor@lemmy.ml !programmer_humor@programming.dev !programmerhumor@kbin.social !programming_horror@programming.dev

Other Programming Communities !programming@beehaw.org !programming@programming.dev !programming@lemmy.ml !programming@kbin.social !learn_programming@programming.dev !functional_programming@programming.dev !embedded_prog@lemmy.ml

founded 2 years ago
MODERATORS
 

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?

you are viewing a single comment's thread
view the rest of the comments
[–] kinther@lemmy.world 3 points 2 weeks ago

I write a main function that is called by the name in main if block. I understand the reason behind it and also write name in main if blocks for utilities I import (eg utilities.py), which prints usage information to direct the user on how to use things properly.

It doesn't make sense initially but I've gotten used to it. Doesn't bother me anymore.