22 lines
442 B
Python
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
|