Derived from the flake8-pyi linter.
What it does#
Checks for union annotations that contain redundant numeric types (e.g.,
int | float).
Why is this bad?#
int is a subtype of
float is a subtype of
complex. As such, a union that includes both
redundant, as it is equivalent to a union that only includes
For more, see PEP 3141, which defines Python's "numeric tower".
Unions with redundant elements are less readable than unions without them.