Dunder methods are special

Scott Irwin

Abstract

Special methods are a powerful feature of Python. Such methods have names starting and ending with double underscores (aka dunder). In this talk, we will explore some of those special methods and show how you can use them to make your custom types more full-featured.

Description

Special methods are those methods on a type which are called implicitly by Python to execute a certain operation (e.g., addition). These methods have distinctive names which start and end with double underscores (aka dunder).

Dunder methods are a language feature which allows developers to implement custom types which have the same features and expressiveness as the Python standard types.

It is impossible to discuss all of the various dunder methods in a single 25-minute talk, so we will focus on a selected subset of dunder methods. We will discuss how and why you would implement them and in which situations Python will implicitly call them.

Bio

Scott is a Senior Software Engineer at Bloomberg LP where he both develops business critical applications using Python and trains other developers in the Python language.