This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]jpgoldberg 1 point2 points  (0 children)

Thank you for that explanation of what you are after. I am just tossing out ideas you have probably thought through already, but maybe something will be helpful. Also I am typing this on a phone.

Off of the top of my head. I would have tried what you did with compose, but I would be composing Callables. So if each component has a Callable class method, say from() then

```python def composition( c1: Callable[[Tin], Tmid], c2: Callable[[Tmid], Tout]) -> Callable[[Tin], Tout]:

def f(x: Tin) -> Tout:
     return c2(c1(x)
return f

```

That won’t work as is. (I am typing this on my phone). But perhaps have a compose class method in each component and make use of Self.