Multiple and predicative dispatch

Speaker David Mertz Track Data Science and Engineering Type Regular talk (45 minutes) Abstract One of the fundamental operations in structured programming is "dispatching" operations to relevant blocks of code, based on some criteria a program can determine. Most Python programmers are familiar with object-oriented programming in which a call to instance.method() will examine the class of instance to determine the specific code called. This uses something called an MRO (method resolution order). However, OOP is far from the only possible dispatch strategy. One alternative approach is something called multiple dispatch, also known as multimethods. Under this approach, the types (and perhaps number) of the arguments to a function rather than its inheritance tree determine which code is utilized to implement a function or method call. Function overloading in languages like C++, Java, Julia, or Fortran, are limited examples of multiple dispatch; Python itself also offers a limited version with its @singledispatch operator. Under true multiple dispatch, the types of ALL the arguments to a function are considered in the decision of which code to execute. Many people have implemented Python modules to support full multiple dispatch, dating from the early 2000s, including for example, Guido van Rossum and myself. Those are all nice tools, varying somewhat in syntactic approaches and specific resolution rules. An extension of this idea has been implemented less widely, but I have created an example implementation which I believe has some nice properties. This idea is "predicative dispatch." We can create several versions of a function that vary not only in the data types passed as arguments, but also by properties these arguments might have. In a simple example, we might have code paths for integer arguments, but also different paths depending on whether these integers are positive or negative. ========================== Sponsors of PyCon Africa 2025 ========================== Platinum sponsor: Valkey: https://valkey.io/ Regional Diamond: Thinkst Canary: https://thinkst.com/ Amazon Web Services (AWS): https://aws.amazon.com/developer/ Gold Sponsors: Apify: https://apify.com/ Canonical: https://www.canonical.com/ Regional Gold: NICIS: https://www.nicis.ac.za/ Silver Sponsor: Google: https://google.com/ Regional Silver: Cyber Mint: https://www.cyber-mint.com/ Bronze Sponsor: Caktus Group: https://www.caktusgroup.com/ Regional Bronze: Prelude.Tech: https://prelude.tech/ Afrolabs: https://afrolabs.co.za/ CoderLevelUp: https://coderlevelup.org/ Contributing Sponsors: Lincoln Loop: https://lincolnloop.com/ Django Software Foundation: https://www.djangoproject.com/foundat... DEFNA: https://www.defna.org/ Black Python Devs: https://blackpythondevs.com/ Naughty Bean Coffee: https://www.naughtybean.coffee/ Zyelabs: https://zyelabs.net/ Asuer: https://asuer.co.za/ Wrend Holdings: https://wrendholdings.com/

Zig 2026: No-AI Policy, $670K Foundation, Left GitHub & Why Zig Isn’t 1.0 - Andrew Kelley Explains
▶︎

Zig 2026: No-AI Policy, $670K Foundation, Left GitHub & Why Zig Isn’t 1.0 - Andrew Kelley Explains

You are not your code   unsolicited advice from a no longer new developer
▶︎

You are not your code unsolicited advice from a no longer new developer

Creator of C++: Bell Labs, Negative Overhead Abstraction, Mistakes | Bjarne Stroustrup
▶︎

Creator of C++: Bell Labs, Negative Overhead Abstraction, Mistakes | Bjarne Stroustrup

Keynote: After the AI Hype – What’s Real, and What’s Next - Richard Campbell - 2026
▶︎

Keynote: After the AI Hype – What’s Real, and What’s Next - Richard Campbell - 2026

Are New Software Engineers Worse
▶︎

Are New Software Engineers Worse

Casey Muratori – The Big OOPs: Anatomy of a Thirty-five-year Mistake – BSC 2025
▶︎

Casey Muratori – The Big OOPs: Anatomy of a Thirty-five-year Mistake – BSC 2025

Introduction to Programming and Computer Science - Full Course
▶︎

Introduction to Programming and Computer Science - Full Course

Billionaire's WARNING: I'm SELLING. The Crash Is Already Here!
▶︎

Billionaire's WARNING: I'm SELLING. The Crash Is Already Here!

How I Automated The Worst Part of My Job Until it Tried To Eat Me Alive
▶︎

How I Automated The Worst Part of My Job Until it Tried To Eat Me Alive

Murottal Pagi Pembuka Rezeki | Surah Al Waqiah,Yasin,Ar Rahman,Al Mulk | murottal alquran merdu
▶︎

Murottal Pagi Pembuka Rezeki | Surah Al Waqiah,Yasin,Ar Rahman,Al Mulk | murottal alquran merdu

The Uncomfortable Truth About AI “Reasoning” | World Science Festival
▶︎

The Uncomfortable Truth About AI “Reasoning” | World Science Festival

Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
▶︎

Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones

The Story of Conformal Gravity
▶︎

The Story of Conformal Gravity

Andrej Karpathy: From Vibe Coding to Agentic Engineering w/ Stephanie Zhan
▶︎

Andrej Karpathy: From Vibe Coding to Agentic Engineering w/ Stephanie Zhan

But what is quantum computing?  (Grover's Algorithm)
▶︎

But what is quantum computing? (Grover's Algorithm)

Creator of uv, ty, Ruff: How Software Engineering Is Changing | Charlie Marsh
▶︎

Creator of uv, ty, Ruff: How Software Engineering Is Changing | Charlie Marsh

Automated Testing Without the Pain
▶︎

Automated Testing Without the Pain

Servers Get Stressed Too: Subtle Ways We Overload Our Systems Without Realizing It
▶︎

Servers Get Stressed Too: Subtle Ways We Overload Our Systems Without Realizing It

Agent Skills or MCP in the era of Claude Code?
▶︎

Agent Skills or MCP in the era of Claude Code?

What rebuilding AlphaGo teaches us about self-play, RL, and future of LLMs - Eric Jang
▶︎

What rebuilding AlphaGo teaches us about self-play, RL, and future of LLMs - Eric Jang