Defining a type where the runtime type is selected at runtime

Thanks. This works for ensuring that a function with -> int only returns an int but not for ensuring that I have MPZ when I should rather than int. An example is:

def g(x: MPZLike) -> MPZLike:
    return x + 1

g(1) # checks fine

Now the function g is operating with int when I wanted it to use MPZ. I can also end up having a mixed list of MPZ and int:

a: list[MPZLike] = [1, 2, MPZ(3)]

For examples of why I want to care about this in both directions see e.g. broken int printing and perf problems with int or gmpy2.mpz broken with log. The situation here is that I can have a protocol to regulate my own usage but I still always have a strong preference about which type it is regardless of whether they seem to be compatible with a protocol: if I say it is MPZ then it should be MPZ and not int and vice versa.