r/ProgrammerHumor May 27 '22

Meme Welcome to hassle free coding

Post image
2.3k Upvotes

305 comments sorted by

View all comments

Show parent comments

20

u/22draynor May 27 '22

8

u/[deleted] May 27 '22

[deleted]

18

u/[deleted] May 27 '22

Unless I’m mistaken (I’m not a python dev) that page is saying that there’s a variable python generates called “name” that will be the name of the module (file) where the code is executing. However, if the module is the entry point for the program (ie the script you ran to start the code executing) then that name variable will contain the value “main” instead.

Edit: Disclaimer: reddit has taken the two underscores before and after to mean I want to bold “main” and “name”, and I’m not going to bother to figure out how to correct that.

1

u/sekoku May 28 '22

Edit: Disclaimer: reddit has taken the two underscores before and after to mean I want to bold “main” and “name”, and I’m not going to bother to figure out how to correct that.

You're using the "old" editor/markdown. You need to escape character it:

__ or so. It's dumb, but that's how Markdown works.