Module providing magic result types via Python macros
Project description
Magic Results
Usage:
# -*- coding: macro -*-
from magicresult import Result, ok, error, attempt
def get_str_ok() -> Result[str]:
return ok("hello world")
def get_str_err() -> Result[str]:
return error("something went wrong")
def magic_example() -> Result[None]:
a = attempt(get_str_ok())
print("First string is: " + a)
b = attempt(get_str_err())
print("Second string is: " + b)
return ok(None)
print(f"magic_example returned {magic_example()}")
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
magicresult-0.0.0.tar.gz
(4.9 kB
view details)
Built Distribution
File details
Details for the file magicresult-0.0.0.tar.gz
.
File metadata
- Download URL: magicresult-0.0.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e872996171f2848acf6253de723c37226070029a575b63ab984b1bffa9197a8 |
|
MD5 | 912bb5714192722aab2fb8137438d527 |
|
BLAKE2b-256 | ddfcf498b7d55bfcf6a994281097484bf1a7a726874c5746e5e1732d62014413 |
File details
Details for the file magicresult-0.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: magicresult-0.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c21bfa038c01c30124b17fcef7341a30619360ea9ad48328e9c5e3f96f01afd |
|
MD5 | 00a6f5cc0c9a9acd3d5ee1ac121d03a5 |
|
BLAKE2b-256 | 72cc51dabbc57c6029840ad6bd859c4873400525fd13dc35a1e72c1a318a2657 |