-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
bugmypy got something wrongmypy got something wrongfalse-positivemypy gave an error on correct codemypy gave an error on correct codepriority-0-high
Description
Hi there !
Trying to annotate a class inheriting from both a sequence and an items view will raise an error, although I believe both definitions are compatible in the following case:
from typing import *
K = TypeVar('K')
V = TypeVar('V')
class OrderedItemsView(Generic[K, V], ItemsView[K, V], Sequence[Tuple[K, V]]):
def __iter__(self) -> Iterator[Tuple[K, V]]:
return iter([])This example raises:
test.py:7: error: Definition of "__iter__" in base class "ItemsView" is incompatible with definition in base class "Sequence"
although, for the two base classes, I believe __iter__ to be defined as Iterator[Tuple[K, V]].
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongfalse-positivemypy gave an error on correct codemypy gave an error on correct codepriority-0-high