PEP-544 Protocols: Structural subtyping (static duck typing)

Abstract

Type hints introduced in PEP 484 can be used to specify type metadata for static type checkers and other third party tools.

However, PEP 484 only specifies the semantics of nominal subtyping.

In this PEP we specify static and runtime semantics of protocol classes that will provide a support for structural subtyping (static duck typing).