yeah. poorly worded.
yeah. poorly worded.
yeah, that was ambiguously worded.
Grow up. he did.
he has. people just prefer to go on judging. how you supposed to feel good about yourself if the people you hate for hating stopped hating?
then don’t ask questions you can find out in other comments.
because people like things.
maybe read the headline and the comments, but only like 30% before i react. I guess 75% for the headline maybe.
i get it, and don’t mind seeing him these days, but I don’t seek him out.
so much better
If you don’t let people make mistakes, change, and grow, you’re living a petty, sad life.
they’re responding to other comments, like about Pewdiepie being a nazi.
fair enough. My personal opinion might be that it’s evil, but perhaps that’s because I expected some kind of order.
Yes, because
In the first kind of language, the thought process is basically: I have the flow of execution, starting at the top of the file. If I want to make a library, I should build the things I want to build, then get out of the way.
Note the “I have the flow of execution”, and the “if I want to build a library”.
If you just want to build an executable, do as you wish, you already have the flow of execution.
If you want to build a library, make the relevant classes and functions and get out of the way (i.e., no IO, no long-running tasks).
If you want to combine them, use the main name check - or, make a package and do entry points that way. Either way works, because both can fulfill the goal of staying out of the way of those importing this as a library.
indeed.
It simply swaps some things around to make things more confusing, then goes into an infinite loop (whether or not you import or execute it standalone). it’s no different than just including in the global scope:
while True:
pass
I was kinda lazy with the fuckery, tbh. I could have gotten much more confusing, but don’t have too much time today. :-)
I always use
if "__main__" == main:
__main__()
…and earlier in the code:
def __main__():
while True:
pass
main = "__main__"
This helps to prevent people from arbitrarily running my code as a library or executable when I don’t went them to.
All code needs to have an entry point.
For Python and some other languages, this is the start of the file.
For other languages, this is a special function name reserved for this purpose - generally, “main”.
In the first kind of language, the thought process is basically: I have the flow of execution, starting at the top of the file. If I want to make a library, I should build the things I want to build, then get out of the way.
In the other kind of language, the thought process is basically: I am building a library. If I want to make an executable, I should create an entry point they the execution starts at.
The debate is honestly pretty dumb.
Due to the oneness of all things, I refuse to distinguish between library code and executable code. One and Zero are arbitrary limitations.
-bro, but yeah, good point.