Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resultify decorator #44

Closed
felixhammerl opened this issue Jul 6, 2021 · 2 comments
Closed

Resultify decorator #44

felixhammerl opened this issue Jul 6, 2021 · 2 comments

Comments

@felixhammerl
Copy link

Hi folks,

first of all, thanks for this implementation! In my fork of your repo (has a couple of things that would break compatibility in your repo, hence didn't put up a PR and released separately) is one helpful utility that can be simply dropped into your repo.

https://github.com/felixhammerl/resultify/blob/master/resultify/__init__.py#L102-L115

It's a decorator wraps ordinary functions and makes them return Ok(...) for normal return values, or Err(...) for raised Exceptions. Let me know if you're interested and I'll happily open a PR for it.

@francium
Copy link
Member

francium commented Jul 7, 2021

Hey Felix,
I feel like I've seen something like this somewhere (pretty sure it's this https://github.com/dry-python/returns#maybe-container -- ctrl-f to search for @maybe).
Thanks for bringing it up, I'll have a closer look when I get more time.

@wbolster
Copy link
Member

Closing since this is pretty much the same as #33, and that one has more info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants