PyDocs

Nav

Development Tools

is_protocol

typing

function · Added in 3.13 (source)
  • is_protocol(tp)
Return True if the given type is a Protocol.

Example::

    >>> from typing import Protocol, is_protocol
    >>> class P(Protocol):
    ...     def a(self) -> str: ...
    ...     b: int
    >>> is_protocol(P)
    True
    >>> is_protocol(int)
    False
0 Examples
No examples for typing/is_protocol.
See Also
No see-alsos for typing/is_protocol
0 Notes
No notes for is_protocol