PEP-544에 소개된 프로토콜의 유효하지 않은 정의 및 사용 사례를 보고합니다.

예:


from typing import Protocol


class MyProtocol(Protocol):
    def method(self, p: int) -> str:
        pass


class MyClass(MyProtocol):
    def method(self, p: str) -> int: # 'method'의 타입이 'MyProtocol'과 호환되지 않습니다
        pass


class MyAnotherProtocol(MyClass, Protocol): # 프로토콜의 모든 베이스는 프로토콜이어야 합니다
    pass