Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save thepabloaguilar/103e4a375fb311e7b85a4a9e932fe5f7 to your computer and use it in GitHub Desktop.
Save thepabloaguilar/103e4a375fb311e7b85a4a9e932fe5f7 to your computer and use it in GitHub Desktop.
[Article] Monkey Patching is not too bad - Result container example
from returns.result import Failure, Result, Success
def is_even(number: int) -> Result[int, int]:
if arg % 2 == 0:
return Success(number)
return Failure(number)
assert is_even(2) == Success(2)
assert is_even(1) == Failure(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment