To achieve this level of type safety with mypy, where distinct calls to IntegersModN produce incompatible types, you can utilize generics and TypeVar in Python’s typing system. Specifically, you can use TypeVar with a bound type to ensure that instances of different classes (even for the same modulus) are treated as incompatible by mypy.