Skip to main content

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


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 Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page