Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
console session demonstrating function composition
>>> def compose(g, h):
... def anon(x):
... return g(h(x))
... return anon
...
>>> f3 = compose(f1, f2)
>>> f3("Shillalegh")
<__main__.Func object at 0x100569dd0>('Shillalegh') called
f1('Shillalegh') called
'Shillalegh'
@ceeblet

This comment has been minimized.

Copy link
Owner Author

ceeblet commented Mar 10, 2015

f1 and f2 were previously defined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.