We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm getting a mypy error when I inherit from multiple base classes which define the same class variable.
mypy
A minimal script looks like:
class Obj: ... class Left(Obj): ... class Right(Obj): ... class A: val: Obj class B(A): val = Left() class C(A): val = Right() class D(B, C): ...
The error I get is:
Definition of "val" in base class "B" is incompatible with definition in base class "C" [misc]
I was expecting there to be no error here. The following script works, for instance:
class Obj: ... class Left(Obj): ... class Right(Obj): ... val: Obj val = Left() val = Right()
I can avoid the error by changing the definitions of B and C to:
B
C
class B(A): val: Obj = Left() class C(A): val: Obj = Right()
But this seems redundant.
Environment
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I'm getting a
mypy
error when I inherit from multiple base classes which define the same class variable.A minimal script looks like:
The error I get is:
I was expecting there to be no error here. The following script works, for instance:
I can avoid the error by changing the definitions of
B
andC
to:But this seems redundant.
Environment
The text was updated successfully, but these errors were encountered: