Skip to main content

Module providing magic result types via Python macros

Project description

Magic Results


# -*- 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

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)

Uploaded source

Built Distribution

magicresult-0.0.0-py2.py3-none-any.whl (4.6 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page