On this page
  1. abc.abstractmethod
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

abc.abstractmethod

Prev: abc.abstractclassmethod | Up: abc | Next: abc.abstractproperty
Rel: abc.ABC, abc.ABCMeta, abc.abstractclassmethod, abc.abstractproperty
Ref: docs.python.org — abc.abstractmethod
Tags: #public #python3 #stdlib #abc


Import

import abc
from abc import abstractmethod

Signature & Overview

abc.abstractmethod(funcobj)

A decorator indicating abstract methods.

Usage

from abc import ABC, abstractmethod

class Repo(ABC):
    @abstractmethod
    def get(self, key: str) -> str: ...

try:
    Repo()
except TypeError:
    assert True

Gotchas

REPL Inspect

from abc import abstractmethod
help(abstractmethod)

Linked from

Related notes