this post was submitted on 28 May 2025
245 points (96.9% liked)

Programmer Humor

36119 readers
517 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 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
[–] ryannathans@aussie.zone 29 points 1 week ago (12 children)

They do different things lol

The main functions define entry points and the python example executes the code only if that script was invoked directly

[–] fushuan@lemm.ee 10 points 1 week ago (11 children)

Agreed, when building the wheel in python we can also define entry points like a main function, and run it the same way the compiled C code is run.

These people are comparing the interpreted raw python code to a compiled C binary. My dudes, bash doesn't have a main function either and no one is fucking complaining.

[–] poopsmith@lemmy.ml 1 points 1 week ago (1 children)

I don't see a lot of people building web servers in Bash. I think part of the point is that Python is a scripting language that likes to cosplay as a GPL.

[–] barubary@infosec.exchange 4 points 1 week ago

Do you know the difference between a script and a program?

A script is what you give the actors; a program is what you give the audience.

load more comments (9 replies)
load more comments (9 replies)