Errors as values for Python.
Project description
no_exceptions
Errors as values for Python. A more functional alternative to try-except blocks, offering less indented code and a
chainable API.
- Do you hate exceptions?
- Do you hate the extra indentation they bring?
- Do you hate the convoluted flow of control they seed?
- Do you hate APIs that throw exceptions in not-really-erroneous cases (like
ZeroDivisionError,KeyError,IndexError,StopIteration)?
Use this package to switch from this:
def some_func() -> float:
...
try:
return numerator / denominator
except ZeroDivisionError:
return 0.0
to this:
from no_exceptions import try_expecting
def some_func() -> float:
...
return try_expecting(lambda: numerator / denominator, ZeroDivisionError).unwrap_or(0.0)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
no_exceptions-0.1.0.tar.gz
(3.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file no_exceptions-0.1.0.tar.gz.
File metadata
- Download URL: no_exceptions-0.1.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11282ad80a19ef7f75492d6cf144621c3a5b444a91f69c9e5ec97fe5e8364ba5
|
|
| MD5 |
2d39d3937e46482527cb55ada4583b67
|
|
| BLAKE2b-256 |
989d22a36996858fe1a1dec3efd68887bfcc8d2378cfa6573f5885091ad13b49
|
File details
Details for the file no_exceptions-0.1.0-py3-none-any.whl.
File metadata
- Download URL: no_exceptions-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7abaa45b291f10f2322b7ee7ec77873f0b262ec1a55c4bb345cf77f74753f43e
|
|
| MD5 |
7d1640b91e921ad4dd1edb06671bd33a
|
|
| BLAKE2b-256 |
da5d554f19f07092841d0789e6ac40db61918693f72c9a74e8ae496117233142
|