Why.

Python’s numeric types complex, float and int are not subtypes of each other, but to support common use cases, the type system contains a straightforward shortcut: when an argument is annotated as having type float, an argument of type int is acceptable; similar, for an argument annotated as having type complex, arguments of type float or int are acceptable.

https://typing.python.org/en/latest/spec/special-types.html#special-cases-for-float-and-complex

⤋ Read More