4 ms·
Startpoint: A saner replacement for `if __name__ == “__main__”`
- deleted 9y ago[deleted]
- pavelbr 9y agoTry it online: https://tio.run/##TU87DsIwDJ3xKQxLGomPEFsFiAFYOQBClQspjdTEUeqBnr6UFhU8We/Z75NTXbbtnQT3WJqq4mVocLtVp8tZQRHZYS0UJbD1gtYFjoLGS2x6BA6/PckyT85k2Rypkl1FLn9QGuKHmh3Zq/HfmelMI0c0LyvJWmt4mAIdWZ9QfNY6hUnRsRatxw9wXae3DpsMWlZDFw5gyDxI/of@mvRlYKjUS18Vr9Tt@xwaKdlvfpULZswpgrmXjItuxpPRoW3f https://tio.run/##TU87DsIwDJ3xKQxLGomPEFsFiAFYOQBClQspjdTEUe...
- earenndil 9y agoTo be honest, the overhead of getting a library such as this one integrated into a project...isn't worth the overhead or extra time taken over just writing `if __name__ == "__main"`. Yes, having to write that out is shitty, and there should be a better way, but that's the best we have and a librarified solution isn't better, it's missing the point.
- pavelbr 9y agoI thought about this for a while before I published it. In the end, I thought it was neat and didn't see a reason not to.