> def is_prime(number: int) -> bool: > … > # number must be integer > if type(number) != int: > raise TypeError("Non-integers cannot be tested for primality.") By providing a type annotation, you have already documented that only `int`s should be passed to the function, and you could even use static analysis tools to verify this. There is no need to do a dynamic type check on top of that. Even without type annotations, there are good arguments for not doing type checks, as explained very well, for example, in section 4 of [this answer to another question][1]. [1]: http://codereview.stackexchange.com/a/39822/67888