I have a class that inherits from MutableSequence
like this:
class QqTag(MutableSequence):
def __init__(self):
self._children = []
def __getitem__(self, idx: int) -> 'QqTag':
return self._children[idx]
mypy complains that Signature of "__getitem__" incompatible with supertype "Sequence"
.
In Sequence
, this method is defined as:
@abstractmethod
def __getitem__(self, index):
raise IndexError
So, what's the problem and why mypy isn't happy with my implementation?