# Pastebin vvpp1hm1 Here, the assertions are both defensive programming and checked documentation. I consider this to be a far superior solution than this: if target == x: run_x_code() elif target == y: run_y_code() elif target == z: run_z_code() else: # This can never happen. But just in case it does... raise RuntimeError("an unexpected error occurred") This tempts some helpful developer to "clean it up" by removing the "unnecessary" test for value==c and removing the "dead code" of the RuntimeError. Besides, "unexpected error" messages are embarrassing when they occur, and they will.