This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Callable | |
class A: pass | |
class B: pass | |
class C: pass | |
def composition(aToB: Callable[[A], B], | |
bToC: Callable[[B], C]) -> Callable[[A], C]: | |
"""Returns a callable that takes an A and returns a C""" | |
def aToC(a: A) -> C: | |
return bToC(aToB(a)) | |
return aToC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment