In Python, it’s possible to get a type error at runtime by combining values in the wrong way. Here’s an example:
TypeError we get here is latent, hiding until a bad value comes in. When we pass
add3, there’s no problem; but when we pass
'uh oh' to
+ operation doesn’t know how to combine an int and a str, so we get a
TypeError. Like the
NameError, the program stops just as soon as the error occurs.