Rust-like Result type for Python
TIL: This library implements a Rust-like Result
type for Python 3.
It plays nicely with mypy
and has a similar interface as Rust’s Result
. You can even use Haskell-inspired do notation:
int, str] = do(
result: Result[+ y)
Ok(x for x in Ok(1)
for y in Ok(2)
)
However, this might alienate your Python colleagues, so use with care.