Python errors as values
Safer error handling, inspired by Go and Rust
You're viewing a single thread.
If you wrote the type signature of get_user as tuple[User, None] | tuple[None, Exception], the assertion would not be necessary and the type checker wouldn't complain.
get_user
tuple[User, None] | tuple[None, Exception]