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.1-py3-none-any.whl (56.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: abstracts-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 56.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7fac9a6a15508ab49b990748344a409873d74c69da1c752611a541adfedf5756
MD5 b7e79be330359b0e40f395b7c02521cc
BLAKE2b-256 651f82c41d7229b2e6769ea6103f0d348af85f97e3a14b75ffaf73dbeb88f553

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