Markdown Format | JSON API | MCP Server Tool
Help on class Protocol in typing: typing.Protocol = class Protocol(Generic) | Base class for protocol classes. | | Protocol classes are defined as:: | | class Proto(Protocol): | def meth(self) -> int: | ... | | Such classes are primarily used with static type checkers that recognize | structural subtyping (static duck-typing), for example:: | | class C: | def meth(self) -> int: | return 0 | | def func(x: Proto) -> int: | return x.meth() | | func(C()) # Passes static type check | | See PEP 544 for details. Protocol classes decorated with | @typing.runtime_checkable act as simple-minded runtime protocols that check | only the presence of given attributes, ignoring their type signatures. | Protocol classes can be generic, they are defined as:: | | class GenProto(Protocol[T]): | def meth(self) -> T: | ... | | Method resolution order: | Protocol | Generic | builtins.object | | Class methods defined here: | | __init_subclass__(*args, **kwargs) from typing._ProtocolMeta | This method is called when a class is subclassed. | | The default implementation does nothing. It may be | overridden to extend subclasses. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __abstractmethods__ = frozenset() | | __parameters__ = () | | ---------------------------------------------------------------------- | Class methods inherited from Generic: | | __class_getitem__(params) from typing._ProtocolMeta
Generated by phpMan Author: Che Dong Under GNU General Public License
2026-06-02 10:31 @216.73.216.198 CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)