Skip to main content

Protocols, Polymorphism and Descriptors

  • Chapter
  • First Online:
A Beginners Guide to Python 3 Programming

Part of the book series: Undergraduate Topics in Computer Science ((UTICS))

  • 427k Accesses

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to John Hunt .

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Springer Nature Switzerland AG

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics