Created
June 26, 2016 04:08
-
-
Save thomasballinger/b8c1c49585100d926a7b084866c1a466 to your computer and use it in GitHub Desktop.
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