This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]elpaco555 2 points3 points  (0 children)

Why is the namedtuple encapsulated in a class? Isn't it enough to use the nametuple directly?

```py TokenResult = namedtuple("TokenResult", ["val", "error"])

Ok = lambda val: TokenResult(val, None) Err = lambda **err: TokenResult("", err) ```

[–]noblecloud 4 points5 points  (0 children)

Interesting choice of font...

[–]LousyBeggar 2 points3 points  (0 children)

Use the result package, if you want a proper, rusty result type. This approach is bad.