Any Reason Why Bare-except's Are Frowned Upon
In a limited fashion, I'm wondering why it's so frowned upon to use a bare-except in Python. I get that if I have a full program running and I do something like: import sys from ap
Solution 1:
One of the reasons for saying bare-excepts to be a bad idea is that, according to Python, or any language it might be, anything that forces a program to quit is an exception.
Example, A Ctrl+C from the terminal
So, we are looking for a specific type of error which causes the program to close, and perform an action accordingly. So, specifying the type of exception to be handled helps to narrow down the actual cause and help you make amends
Post a Comment for "Any Reason Why Bare-except's Are Frowned Upon"