I'm currently studying PEP544 to see whether type hinting protocols can help me in my development workflow.
In the section Explicitly Declaring Implementation, there is some code which I have rewritten as follows:
from typing import Protocol
from abc import abstractmethod
class PColor(Protocol):
@abstractmethod
def draw(self) -> str: ...
def complex_method(self) -> int:
return 1+1
class NiceColor(PColor):
def draw(self) -> str:
return "deep blue"
class BadColor(PColor):
def draw(self) -> str:
return super().draw()
According to the PEP, the line return super().draw() should throw an error as there is no default implementation in PColor.
I've tried running this with python test.py and mypy --strict test.py, and both of them run without throwing an error.
Is there a mistake in the PEP, or am I missing something?