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.3.tar.gz
(3.1 kB
view hashes)
Built Distribution
Close
Hashes for final_class-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d4712c477f1316454608938f38d8e60724c8c70aa60627bec748987d6c1ff1c |
|
MD5 | 8cb2555e23ec89b17c1ca1598febe578 |
|
BLAKE2b-256 | df44eca224f4df296e564ca365a087cc0688b2ed54694df64602795377ba261c |