We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Protocols - Static duck typing for decoupled code

Formal Metadata

Title
Protocols - Static duck typing for decoupled code
Title of Series
Number of Parts
112
Author
Contributors
License
CC Attribution - NonCommercial - ShareAlike 4.0 International:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
Python introduces Protocols to support static duck typing, where static type checkers (mypy) and other tools can verify code correctness prior to runtime. This was added in order to circumvent explicitly inheriting from ABCs (Abstract base classes) which is ""unpythonic and unlike what one would normally do in idiomatic dynamically typed Python code"" - according to PEP 544. We will explore the different use cases for Protocols and how to use them correctly.