A python implementation of the Result type, based on the rust language
Project description
A python implementation of the Result type, based on the rust language
Installation
pip install typing-result
or
poetry install typing-result
Usage Example
def div(x: float, y: float) -> Result[float, ZeroDivisionError]:
if y == 0:
return Err(ZeroDivisionError("Ops"))
return Ok(x / y)
result = div(10, 2)
match result:
case Ok(v):
print(v)
case Err(e):
# handle error here
...
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
typing_result-0.1.2.tar.gz
(2.8 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 typing_result-0.1.2.tar.gz.
File metadata
- Download URL: typing_result-0.1.2.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.10.10 Linux/6.2.11-arch1-1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c2eb49a03c74a5c4b2019d6a580acf10ed449ad133e1acbd4714a6866d8c531
|
|
| MD5 |
e08c5f82be13ba52ebee0ca636d7dab0
|
|
| BLAKE2b-256 |
dc3879031661427c6f7b5bcb0ea7d5ba7a098de391733c37810545837bc5dc97
|
File details
Details for the file typing_result-0.1.2-py3-none-any.whl.
File metadata
- Download URL: typing_result-0.1.2-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.10.10 Linux/6.2.11-arch1-1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
593470194b092a1c3cf238a86cc02a77cd53f6770e28c8c42bb29b44e228f0be
|
|
| MD5 |
89f929cbf2b558029a5dc2996a2124f5
|
|
| BLAKE2b-256 |
6afe5e087a0203d1a985e2be081a906eaa637eb8b87353b9a7ba7647f686fb90
|