We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Abstract Base Classes: a smart use of metaclasses

Formal Metadata

Title
Abstract Base Classes: a smart use of metaclasses
Title of Series
Number of Parts
160
Author
License
CC Attribution - NonCommercial - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
Abstract Base Classes: a smart use of metaclasses [EuroPython 2017 - Talk - 2017-07-11 - PythonAnywhere Room] [Rimini, Italy] This talk shows what Python Abstract Base Classes (ABCs) are and how they can be used to categorise objects and implement a virtual inheritance tree. The goal of the talk is to introduce programmers to the concept of ABCs, and to show that metaclasses are not a terribly complex topic, but something that can be used by normal programmers. The talk is divided in three different “levels of difficulty”, each of one going deeper in the technical aspects of the subject. Level 1: Polymorphism - Behaviours and delegation - Collections The first level is meant to give a quick overview of the collections package and some useful code snippets. Even beginners can benefit of the information given here. To complete this level you only need to know what a try/except block is. Level 2: Registering - Abstract Base Classes - Categories The second level shows what real and virtual inheritance are, explains what is the meaning of registering and defines Abstract Base Classes. To complete this level you need to know what class inheritance is (i.e. what class MyList(list) means). Level 3: Build your ABCs - Metaclasses - ABSs as interfaces The third level shows how to create your own ABCs, why metaclasses are involved and why they are not a difficult concept. I will then quickly review a possible use of metaclasses as interfaces. To complete this level you need to know how to instantiate a class, and the difference between class and instance