A side effect of this question is that I was lead to this post, which states:
Whenever isinstance is used, control flow forks; one type of object goes dow
The first use is fine, the second is not. Pass the argument to int() instead so that you can use number-like types.
int()