Abstract classes in Python

in «tip» by Michael Beard
Tags: , , , ,

Abstract Classes in Python - (on Medium, so ... I have the PDF version in my documents directory as well) - it doesn't say a lot, but it does give slightly more than the code below. Slightly more ...

from abc import ABC, abstractmethod

class Animal(ABC):
    @abstractmethod
    def move(self):
        print('Animal moves')

class Cat(Animal):
    def move(self):
        super().move()
        print('Cat moves')

c = Cat()
c.move()

#### Animal moves
#### Cat moves

Good to know.