Skip to main content

Abstract class and interface definitions

Project description

Abstract class and interface definitions.

Create an abstract.Abstraction

An Abstraction is a metaclass for defining abstract classes.

Let’s define an abstract AFoo class and give it an abstract do_foo method.

Like any python class, an Abstraction can have any name, but it may be helpful to distinguish abstract classes from others by prefixing their name with A.

>>> import abc
>>> import abstracts

>>> class AFoo(metaclass=abstracts.Abstraction):
...
...     @abc.abstractmethod
...     def do_foo(self):
...         raise NotImplementedError

Abstract classes cannot be instantiated directly.

>>> AFoo()
Traceback (most recent call last):
...
TypeError: Can't instantiate abstract class AFoo with abstract method... do_foo

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

abstracts-0.0.2-py3-none-any.whl (64.9 kB view details)

Uploaded Python 3

File details

Details for the file abstracts-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: abstracts-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 64.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.2

File hashes

Hashes for abstracts-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5dba0c53f0997fc1017626e544ab6c2ee1c4b3ffa71472a259d9d8218610cf38
MD5 e4700d3745f38af4d4f0bf89f98665bd
BLAKE2b-256 b30a9d207bfa88e45c3128789ed690e4ada470aa792e964dd42e86ed2a7075b0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page