You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
numbers.Number and similar ABCs in numbers are causing mypy warnings.
To Reproduce
fromnumbersimportNumberdeff(x: Number) ->Number:
# ERROR: Operator "*" not supported for types "Literal[3]" and "Number"return3*x
Additional context
We cannot build type-stable interfaces with numbers.Number, as clearly stated in Fluent Python, 2nd ed:
Sadly, the numeric tower was not designed for static type checking. The root ABC—
numbers.Number—has no methods, so if you declare x: Number, Mypy will not let
you do arithmetic or call any methods on x.
The text was updated successfully, but these errors were encountered:
Describe the bug
numbers.Number
and similar ABCs innumbers
are causing mypy warnings.To Reproduce
Additional context
We cannot build type-stable interfaces with
numbers.Number
, as clearly stated in Fluent Python, 2nd ed:The text was updated successfully, but these errors were encountered: