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 hashes)
Built Distribution
Close
Hashes for magicresult-0.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c21bfa038c01c30124b17fcef7341a30619360ea9ad48328e9c5e3f96f01afd |
|
MD5 | 00a6f5cc0c9a9acd3d5ee1ac121d03a5 |
|
BLAKE2b-256 | 72cc51dabbc57c6029840ad6bd859c4873400525fd13dc35a1e72c1a318a2657 |