Skip to content

Instantly share code, notes, and snippets.

@ykarikos
Last active December 18, 2015 11:39
Show Gist options
  • Save ykarikos/5776874 to your computer and use it in GitHub Desktop.
Save ykarikos/5776874 to your computer and use it in GitHub Desktop.
A function that returns function that accesses a dict
#
# Third iteration, now with reduce!
#
def getFieldAccessor(fields):
return lambda a: reduce(lambda x, y: x[y], fields, a)
@ykarikos
Copy link
Author

Thanks, that did the job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment