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
Release history Release notifications | RSS feed
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 hashes)
Close
Hashes for abstracts-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5dba0c53f0997fc1017626e544ab6c2ee1c4b3ffa71472a259d9d8218610cf38 |
|
MD5 | e4700d3745f38af4d4f0bf89f98665bd |
|
BLAKE2b-256 | b30a9d207bfa88e45c3128789ed690e4ada470aa792e964dd42e86ed2a7075b0 |