Skip to main content

Better ABC

https://stackoverflow.com/questions/23831510/abstract-attribute-not-property

Usage

from better_abc import ABCMeta, abstract_attribute    # see below

class AbstractFoo(metaclass=ABCMeta):

    @abstract_attribute
    def bar(self):
        pass

class Foo(AbstractFoo):
    def __init__(self):
        self.bar = 3

class BadFoo(AbstractFoo):
    def __init__(self):
        pass
Foo()     # ok
BadFoo()  # will raise: NotImplementedError: Can't instantiate abstract class BadFoo
# with abstract attributes: bar

If you want other features of ABC they need to be imported from the abc module directly.

from abc import abstractmethod
from better_abc import ABCMeta, abstract_attribute

Metadata

Release files for better-abc 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for better-abc 0.0.3
File Size Uploaded
better-abc-0.0.3.tar.gz 2.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for better-abc 0.0.3
File Interpreter ABI Platform
better_abc-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 6.3 kB

Release files / better-abc-0.0.3.tar.gz

Download URL better-abc-0.0.3.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a880fd6bc9675da2ec991e8712a555bffa0f12722efed78c739f78343cf989f6
BLAKE2b-256 checksum
How to use checksums
8b723d630f781659015357cc08cad32aa636b252e007df0bae31184a3d872427
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.2.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

Release files / better_abc-0.0.3-py3-none-any.whl

Download URL better_abc-0.0.3-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ae73b473fbeb536a548f542984976e80b821676ae6e18f14e24d8e180647187
BLAKE2b-256 checksum
How to use checksums
d9e87d00a23039ab74c5741736ce05d7700eb6237e83747aac4df07a5bf2d074
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.2.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page