Last active
December 18, 2015 11:39
-
-
Save ykarikos/5776874 to your computer and use it in GitHub Desktop.
A function that returns function that accesses a dict
This file contains hidden or 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
# | |
# Third iteration, now with reduce! | |
# | |
def getFieldAccessor(fields): | |
return lambda a: reduce(lambda x, y: x[y], fields, a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, that did the job!