Python needs an actual default function
Python needs an actual default function
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?
Python needs an actual default function
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?
I call main() in the if
I always use
python
if "__main__" == main: __main__()
..and earlier in the code:
python
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.
Can you elaborate on this blood magic?
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:
python
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. :-)
Lol OK I was wondering how would this run
And yes you should!!