Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Getting to Know Duck Typing in Python (Summary)

Now you know that Python uses duck typing in many language constructs. This type of polymorphism doesn’t rely on inheritance. It only depends on the public methods and attributes (API) of objects. Many Python built-in classes and tools support this type system, which adds flexibility and power to the language.

In this video course, you’ve learned:

  • What duck typing is and what its pros and cons are
  • How Python’s classes and tools take advantage of duck typing
  • How special methods and protocols support duck typing
  • What alternatives to duck typing you’ll have in Python

Learning about duck typing will help you better understand how Python works. It can also help you write more Pythonic, flexible, and decoupled code.

Download

Course Slides (.pdf)

5.6 MB
Download

Sample Code (.zip)

4.2 KB

Become a Member to join the conversation.