Johan B.W. de Vries 2485ccba40 do_call ideas
2023-04-10 16:49:22 +02:00

27 lines
506 B
Python

from typing import Any, Generic, TypeVar
T = TypeVar('T')
class BaseValue(Generic[T]):
__slots__ = ('data', )
data: T
def __init__(self, data: T) -> None:
self.data = data
def __eq__(self, other: Any) -> bool:
return self.__class__ is other.__class__ and self.data == other.data
def __repr__(self) -> str:
return f'{self.__class__.__name__}({repr(self.data)})'
class UntypedValue(BaseValue[Any]):
pass
class BytesValue(BaseValue[bytes]):
pass