this post was submitted on 28 May 2025
237 points (96.8% liked)

Programmer Humor

35972 readers
97 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
[–] [email protected] 28 points 5 days 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

[–] [email protected] 10 points 5 days 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.

[–] [email protected] 1 points 5 days 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.

[–] [email protected] 4 points 5 days 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)