builtup4/bu4/evaluation/constructs/eattachable.py

23 lines
556 B
Python

# Copyright (c) PARRRATE T&V 2021. All rights reserved.
from typing import TypeVar, Generic
from bu4.evaluation.constructs.attachable import Attachable
from bu4.evaluation.constructs.evaluable import Evaluable
__all__ = ('EAttachable',)
T = TypeVar('T')
class EAttachable(Evaluable, Generic[T]):
def __init__(self, t: T, attachable: Attachable[T]):
self.t = t
self.attachable = attachable
def next(self) -> Evaluable:
return self.attachable.attach(self.t)
def __str__(self):
return f'{self.attachable}'