final_class
Final classes for python3.6+.
Features
- No metaclass conflicts
- No runtime overhead
- No dependencies
- Type hints included, PEP-561 and PEP-591 compatible
- Designed to be as simple as possible
Why?
In languages like java we have a nice way
to restrict subclassing any class by making it final:
public final class SomeClass {
// ...
}
In python we don't have such feature out of the box.
That's where final_class library comes in!
This package works perfectly with @final from typing.
So, with final_class you will have both type-checking and runtime checks.
Installation
pip install final_class
Usage
from final_class import final
@final
class Example(object): # You won't be able to subclass it!
...
class Error(Example): # Raises `TypeError`
...
More?
Do you want more? Check out:
License
MIT.
Release files for final-class 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| final-class-0.2.0.tar.gz | 3.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| final_class-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.1 kB
Release files / final-class-0.2.0.tar.gz
| Download URL | final-class-0.2.0.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ae1c4532745aa35867bd7b6dba4d9eb1798c609b0b22d531733372fef32164a7
|
|
BLAKE2b-256 checksum How to use checksums |
290642b63be59b0fd3ee6aeb082f99a0bb9967d0f5ee480f9e9c74b7d6455f3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.11 CPython/3.7.4 Darwin/18.6.0
|
Release files / final_class-0.2.0-py3-none-any.whl
| Download URL | final_class-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8029b75b96e8b50ae5d80a6b2b9683fabea94182861101ee185298d13292a322
|
|
BLAKE2b-256 checksum How to use checksums |
474fd80eec39dba3f9f0d90d275d073de3907492f599e735075ee9fafbe7d77b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.11 CPython/3.7.4 Darwin/18.6.0
|