monad_std.either.Either
Bases: Generic[L, R]
An ancestor class of any Either type, inherited by Left and Right.
convert_either(value, flag)
staticmethod
convert_either_by(op)
staticmethod
is_left()
abstractmethod
is_right()
abstractmethod
of_left(value)
staticmethod
Create a Left value.
of_right(value)
staticmethod
Create a Right value.
unwrap_left()
abstractmethod
Returns the contained Left value.
This method may raise an exception.
Raises:
| Type | Description |
|---|---|
UnwrapException
|
Raises if the value is a |
Examples:
unwrap_left_unchecked()
abstractmethod
Returns the contained Left value.
This method acually returns Optional[L] instead of L.
But it hide the None in the type hint.
The null safety should be guaranteed by the caller.
unwrap_right()
abstractmethod
Returns the contained Right value.
This method may raise an exception.
Raises:
| Type | Description |
|---|---|
UnwrapException
|
Raises if the value is a |
Examples:
unwrap_right_unchecked()
abstractmethod
Returns the contained Right value.
This method acually returns Optional[R] instead of R.
But it hide the None in the type hint.
The null safety should be guaranteed by the caller.