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.0.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for final_class-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc94c2b314cabe528d7cb02684eccd2eb9b238535140f1cacd25ed61468eadcd |
|
MD5 | 292aa63f39234842aa167e6fee58775c |
|
BLAKE2b-256 | c7ce25444296e5c8537946986eee8594ce166eddf9e19d1a59d592625c13fa6a |