final-class-0.2.0
توضیحات
Final classes for Python 3
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | final-class-0.2.0 |
| نام | final-class |
| نسخه کتابخانه | 0.2.0 |
| نگهدارنده | ['sobolevn'] |
| ایمیل نگهدارنده | ['mail@sobolevn.me'] |
| نویسنده | sobolevn |
| ایمیل نویسنده | mail@sobolevn.me |
| آدرس صفحه اصلی | https://github.com/moscow-python-beer/final-class |
| آدرس اینترنتی | https://pypi.org/project/final-class/ |
| مجوز | MIT |
# final_class
[](https://wemake.services) [](https://travis-ci.org/moscow-python-beer/final-class) [](https://coveralls.io/github/moscow-python-beer/final-class?branch=master) [](https://github.com/wemake-services/wemake-python-styleguide)
Final classes for `python3.6+`.
## Features
- No metaclass conflicts
- No runtime overhead
- No dependencies
- Type hints included, [PEP-561](https://www.python.org/dev/peps/pep-0561/) and [PEP-591](https://www.python.org/dev/peps/pep-0591/) 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`:
```java
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
```bash
pip install final_class
```
## Usage
```python
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:
- [1-minute guide to real constants in Python](https://sobolevn.me/2018/07/real-python-contants)
## License
MIT.
نیازمندی
| مقدار | نام |
|---|---|
| >=3.7,<4.0 | typing_extensions |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6,<4.0 | Python |
نحوه نصب
نصب پکیج whl final-class-0.2.0:
pip install final-class-0.2.0.whl
نصب پکیج tar.gz final-class-0.2.0:
pip install final-class-0.2.0.tar.gz