Skip to content

Instantly share code, notes, and snippets.

@tlehman
Created September 6, 2012 17:30
Show Gist options
  • Select an option

  • Save tlehman/3658788 to your computer and use it in GitHub Desktop.

Select an option

Save tlehman/3658788 to your computer and use it in GitHub Desktop.
use C#-like lambda expressions in python
def _(s):
return eval(("lambda " + s).replace("=>", ":"))
# >>> _("x => str(x)")(42) == "42"
True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment