Final classes for Python 3
Project description
final_class
Final classes for python3.6+
.
Features
- No metaclass conflicts
- No runtime overhead
- No dependencies
- Type hints included
- 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!
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`
...
License
MIT.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
final-class-0.1.2.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for final_class-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef3d462e5ef0ee104403bea95cb0675dcb84525d6b4e74cf2fefef24f4f8716f |
|
MD5 | 73ffa85f7a87fe7824c2d5d2e00b14cd |
|
BLAKE2b-256 | 664ae4fdcc82f7eccc558881444b45c5babfd27a7d670cec4d1eb7105f8f637d |