Setting a generic type with a type specification [] to isinstance() and issubclass() gets the wrong error messages as shown below:
*Notes:
- mypy test.py
- Python 3.15.0a6
x = 100
isinstance(x, tuple) # No error
isinstance(x, tuple[int, str]) # Error
class Cls: ...
issubclass(Cls, tuple) # No error
issubclass(Cls, tuple[int, str]) # Error
error: Parameterized generics cannot be used with class or instance checks
Actually, saying "parameterized" reminds function parameters so "argumentized" should be used and "generic types" should also be used as shown below:
*Notes:
- "argumentized" isn't common in general but it's intuitive for the case so it can be used in the tech world.
error: Argumentized generic types cannot be used with class or instance checks
parameterized
argumentized
Setting a generic type with a type specification
[]toisinstance()andissubclass()gets the wrong error messages as shown below:*Notes:
Actually, saying "parameterized" reminds function parameters so "argumentized" should be used and "generic types" should also be used as shown below:
*Notes: