rainbowadn/rainbowadn/nullability/null.py
2022-07-10 21:14:02 +03:00

22 lines
442 B
Python

from typing import Generic, TypeVar
from .nullable import *
__all__ = ('Null',)
NullableType = TypeVar('NullableType')
class Null(Nullable[NullableType], Generic[NullableType]):
def null(self) -> bool:
return True
def _resolve(self) -> NullableType:
raise TypeError('null')
def __eq__(self, other):
if isinstance(other, Null):
return True
else:
return NotImplemented