Abstract Base Classes in Python


Leonardo Giordani

Leonardo was born in 1977, the year of Star Wars, bash, Apple II, BSD and many more. He is interested in operating systems, computer languages, photography, fantasy and science fiction, video and board games amongst other things. He has an experience in many languages including Z80 and x86 assembly, Prolog, C, C++, PHP, Lisp, Ada, Objective-C, Python, Erlang, Clojure, Scala and Javascript. Leonardo loves mathematics and cryptography.



On May 25th, 2017 Blackrock in London hosted a Python meetup. In this talk Leonardo introduced the concept of Abstract Base Classes (ABCs) and what makes them a smart use of metaclasses in Python. He delved into ABCs through 3 levels of complexity to show how they can be used effectively, when to use them and how Python uses them internally.

Leonardo started off with explaining the importance of behavior over structure and touched upon Collections – a Python core module which provides classes representing interesting behaviors. Next, Leonardo dived into Abstract Base Classes by explaining how they can categorise objects and providing an example. Lastly, he gave an overview on how to build your own ABCs and how you can use ABCs to build interfaces.



ID 230426