Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

The Zen of Polymorphism: Choosing Between isinstance(), Methods, and @singledispatch

PyCon US via YouTube

Overview

Coursera Flash Sale
40% Off Coursera Plus for 3 Months!
Grab it
This 43-minute PyCon US talk explores three different approaches to implementing polymorphism in Python, comparing their strengths and weaknesses in practical programming scenarios. Dive into the limitations of using isinstance() checks, which often leads to code duplication, and understand why traditional OOP method polymorphism can result in code being organized inefficiently, hampering understandability and maintenance. Discover the power of @singledispatch from the functools library, which offers an elegant balance between functional and object-oriented programming paradigms. Learn how this lesser-known feature works under the hood and how to implement or integrate similar functionality into your own programs to achieve polymorphic behavior while using simple functions and plain data objects instead of classes. Gain practical insights for writing more maintainable Python code that leverages the language's multi-paradigm nature effectively.

Syllabus

The Zen of Polymorphism: Choosing between isinstance(), methods, and @singledispatch

Taught by

PyCon US

Reviews

Start your review of The Zen of Polymorphism: Choosing Between isinstance(), Methods, and @singledispatch

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.