== Exceptions as efficient programming Python likes to make programming efficient: that is, to make programs fast and easy to write, and eliminate the tedious drudgery. Pretty much all dynamically typed languages do, since static typing is a lot of effort (except in languages with a lot of type inference, where it is only some effort). After writing [[yesterday's entry|ExceptionsAndCasualProgramming]], it's struck me that exceptions are a form of efficient programming, because they let you aggregate error checking and error handling across a large block of code. Without exceptions, proper error checking means a lot of tedious code to check each possibly failing operation and handle the errors. Usually the code is identical or almost identical, making the tedium more pronounced. (This tedium is one reason why people can wind up skipping some error checks.) With exceptions, you only write new code when you want to do something differently on an error. Otherwise, you can cover a large swatch of code, full of various calls that may fail, with just one exception and just one block of code to handle the problem. (Especially if you let fine details of what went wrong for error messages be captured in the exception or in ongoing state variables.) Result: less tedium, more efficiency, happier programmers, and Python helps one of its goals along again.