Skip to main content
Top

Hint

Swipe to navigate through the chapters of this book

2019 | OriginalPaper | Chapter

27. Protocols, Polymorphism and Descriptors

share
SHARE

Abstract

In this chapter we will explore the idea of an implicit contract between an object and the code that uses that object. As part of this discussion we will explore what is meant by Duck Typing. Following this we will introduce the Python concept called a protocol. We will explore its role within Python programming and look at two commonly occurring protocols; the Context Manager Protocol and the Descriptor Protocol.
Metadata
Title
Protocols, Polymorphism and Descriptors
Author
John Hunt
Copyright Year
2019
DOI
https://doi.org/10.1007/978-3-030-20290-3_27

Premium Partner