try-except with No Exceptions Named

The final syntax for try-except we are going to present is one which does not specify an exception on the except header line:


    try_suite # watch for exceptions here
    except_suite # handles all exceptions

Although this code “catches the most exceptions,” it does not promote good Python coding style. One of the chief reasons is that it does not take into account the potential root causes of problems which may generate exceptions. Rather than investigating and discovering what types of errors may occur and how they may be prevented from happening, this type of code “turns the blind eye,” thereby ignoring the possible causes (and remedies).


You may also like...