Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from typing import Union, Generic, TypeVar
- T = TypeVar("T")
- class Expected(Generic[T]):
- def __init__(self, value_or_error: Union[T, Exception]):
- self._value_or_error = value_or_error
- def is_valid(self) -> bool:
- return not isinstance(self._value_or_error, Exception)
Add Comment
Please, Sign In to add comment