Contribute Media
A thank you to everyone who makes this possible: Read More

Making Multiple Inheritance not work in Python

Description

This talk is a destructive examination of the workings of Python's inheritance model. We'll learn how it works by breaking it. After starting with a discussion of how we got to where we are, we'll then move on to the hooks that Python gives us to interact with it. These include using the metaclass to alter the class during construction, as well as using the __init_subclass__ and __subclasscheck__ hooks.

Particular examples will include:

  • Implementing interfaces in Python
  • Turning inheritance off in favor of explicit reuse
  • Simplifying classes by disabling a selection of features you don't wish to use

While none of these are meant to be particularly useful implementations, they make good use cases to show the machinery.

Details

Improve this page