Skip to content

Instantly share code, notes, and snippets.

@dokipen
Created November 5, 2015 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dokipen/36a02b18d86444d2d342 to your computer and use it in GitHub Desktop.
Save dokipen/36a02b18d86444d2d342 to your computer and use it in GitHub Desktop.
import operator
import itertools
def star(fn):
def wrapper(l):
retrun fn(*l)
return wrapper
pairs = [[1,2], [3,4], [5,6]
print map(star(operator.add), pairs)
# >> [3, 7, 11]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment