Skip to content

Instantly share code, notes, and snippets.

@mwaskom
Created May 23, 2014 03:30
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 mwaskom/151d48966f4553d019e0 to your computer and use it in GitHub Desktop.
Save mwaskom/151d48966f4553d019e0 to your computer and use it in GitHub Desktop.
Better to beg forgiveness than ask permission.
def vectorize2(f):
def g(x):
try:
return [f(x) for x in x]
except TypeError:
return f(x)
return g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment