-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
from typing import SupportsAbs, NamedTuple
class Point(NamedTuple('Point', [('x', int), ('y', int)]), SupportsAbs[int]):
def __abs__(p) -> int:
return abs(p.x) + abs(p.y)
def test(a: Point) -> bool:
return abs(a) == 2 # E: Argument 1 to "abs" has incompatible type "Point"; expected SupportsAbs[None]
There's no error in test
if the NamedTuple
superclass of Point
is removed.