Closed
Description
The following snippet triggers a mypy error:
from typing import SupportsComplex
class A(SupportsComplex):
def __complex__(self) -> complex:
return 1j
complex(A())
# No overload variant of "complex" matches argument types [test_simple.A]
I believe this is the right way to indicate that a class supports casting to complex values.
I'm using Python 3.6.4 and mypy 0.560. See numpy/numpy-stubs#10 for context.
Metadata
Metadata
Assignees
Labels
No labels