11 ms·
No, the “readable” shortcut would have been if __main__: There are no magic strings to remember and the IDE can help you look up variables.
by wodenokoto 22d ago
No, the “readable” shortcut would have been
if __main__:
There are no magic strings to remember and the IDE can help you look up variables.
- scoofy 22d agoAgain, this is a CS/Math major kind of thinking. The term __main__ means nothing syntactically. If we care about language acquisition -- thus language adoption -- it is always better to make "very common terms" in the language understandable to someone who is completely illiterate to your formal language. I honestly think one of the main reasons why python is so successful is as simple as: print "Hello world!" ...and later: print("Hello world!") It might not seem like much, but when you're asking someone to pick up a language outside of a classroom setting, it's just much more intuitive than: echo "Hello world!"; or: console.log("Hello world!"); or god forbid: public class GFG{ public static void main(String[] args) { System.out.println("Hello world!"); } } These little things matter in the long run, even if they don't seem like they matter when you're already fluent.
- frollogaston 21d agoIdk what's better, console.log or print, cause way back as a beginner I was confused what it means to print something. Like with ink? They're both ok, unlike the C++ or Java ways. But Python breaking hello world in version 3 was crazy.
- scoofy 21d agoAgain, I would argue “very common commands” like printing text should be so unbelievably intuitive that beginners can use them even before learning what a “console” is, why there are “logs” and how dot notation works.