My philosophy of exceptions: they’re always ambiguous

Exceptions are the norm, not the exception

So you think you know what an “exception” means? Let’s look into a Python example:

# How many exceptions can this code raise?
url = input("Please enter a URL: ") # wait for user input
with urllib.request.urlopen(url) as response: # request the url
bytes =
text = bytes.decode("utf-8")
print(text) # print the HTML

Do we even need a definition?

Obviously, programmers have been reasoning about exceptions for decades without defining what “exception” means. There’s clear evidence: all these programs written in C++, Python, Java and Ruby.

What’s better?

Sorry — this is how it is. Learn to live with it.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adam Hooper

Adam Hooper

Journalist, ex software engineer