Custom property/descriptor and base classes #5803
Labels
bug
mypy got something wrong
false-positive
mypy gave an error on correct code
priority-1-normal
topic-descriptors
Properties, class vs. instance attributes
topic-inheritance
Inheritance and incompatible overrides
I am trying to get this code working:
I run mypy without any flags, i.e. "mypy test.py". The mypy version is 0.641, using Python 3.6.5.
Basically I want to have some kind of base class that says "any subclasses will have a member called
id
and the type of this member isstr
.The two cases labelled with "Bad" result in the errors shown in the comments ("incompatible types in assignment" and "revealed type is 'Any'".
The only case that works is the "Good" one, but it only works because the base class does not define anything.
Am I doing something wrong or is this a bug/limitation in mypy?
The text was updated successfully, but these errors were encountered: