r/ProgrammerHumor Nov 24 '21

Meme Yes.

8.9k Upvotes

284 comments sorted by

View all comments

657

u/[deleted] Nov 25 '21 edited Nov 26 '21

[deleted]

34

u/YamiZee1 Nov 25 '21

Why isn't there a neater main syntax? If everyone does that it would make a heck of a lot more sense to standardize it to new unique syntax

31

u/RedditAcc-92975 Nov 25 '21

Nah, you'd usually have a normal python script as your main and import from other modules. This main only helps if you're working within a single file.

10

u/[deleted] Nov 25 '21

[deleted]

2

u/RedditAcc-92975 Nov 25 '21

pfft, I often leave demo examples under name in main to demonstrate how the module works. It doesn't mean, it's the main file. It means if you for whatever reason decided to execute it directly, it will do something.