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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
Copyright information
© 2019 Springer Nature Switzerland AG
About this chapter
Cite this chapter
Hunt, J. (2019). Protocols, Polymorphism and Descriptors. In: A Beginners Guide to Python 3 Programming. Undergraduate Topics in Computer Science. Springer, Cham. https://doi.org/10.1007/978-3-030-20290-3_27
Download citation
DOI: https://doi.org/10.1007/978-3-030-20290-3_27
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-20289-7
Online ISBN: 978-3-030-20290-3
eBook Packages: Computer ScienceComputer Science (R0)