If it's user input you should sanitize there. In Python this is often easy because you can usually cast as the type you need e.g. with int() and then raise exception if it cannot.
If it's your code, then you should make sure you are passing in an int if that's what is required. If you type hint the input as int, and somewhere in your code you pass in a string, you will get a warning in the IDE.
I would argue that's a very different time and place than checking for instanceof in the running code and that's why isinstance is bad and type-checking is good.
There are always exceptions but it's bad to write them in examples when teaching code.