https://github.com/ddworken/magicresult
https://github.com/ddworken/magicresult
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/ddworken/magicresult
- Owner: ddworken
- Created: 2019-10-13T23:23:56.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-13T23:25:24.000Z (almost 7 years ago)
- Last Synced: 2025-10-18T20:08:31.330Z (9 months ago)
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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()}")
```