Warning: Some posts on this platform may contain adult material intended for mature audiences only. Viewer discretion is advised. By clicking ‘Continue’, you confirm that you are 18 years or older and consent to viewing explicit content.
# Start an infinite loop because True will always be TruewhileTrue:
# try to run the main function, usually where everything happenstry:
main()
# in the case an exception is raised in the main function simply discard (pass) and restart the loopexcept:
pass
But essentially ignoring every single error a program could generate is not great. It’d be better to know what those errors are and fix/prevent them from occurring in the first place.
My secret to high uptime:
while True: try: main() except: pass
that was hilarious xD
Flask developer?
Someone is absolutely going to think this is a real recommendation and do it.
Lurking beginner here, why is this bad?
Basically sweeps errors under rug.
No error handling and go again.
There you go:
# Start an infinite loop because True will always be True while True: # try to run the main function, usually where everything happens try: main() # in the case an exception is raised in the main function simply discard (pass) and restart the loop except: pass
Thank you for that answer! That makes sense.
This gives some better context. https://stackoverflow.com/questions/21553327/why-is-except-pass-a-bad-programming-practice
But essentially ignoring every single error a program could generate is not great. It’d be better to know what those errors are and fix/prevent them from occurring in the first place.
deleted by creator