March 13, 2023
7:36 a.m.
Excerpts from Никита Соболев's message of mars 13, 2023 12:31 am:
You can use something like https://github.com/dry-python/returns#result-container It just works right now!
Thanks! I like to see new paradagims and well design frameworks like this. I was not aware of "returns" and I'll study it, however I'm pretty happy how Python exceptions work by default, just looking for more static typing. Back to the first example, I plan to work on a decorator like this: @raises(ValueError, SomeError, AnotherError) def foo(i: int): if i == 0: raise ValueError("Must not be zero") elif i == 1: raise SomeError("Must not be one") elif i == 2: raise AnotherError("Must not be two") print("that's ok")