Skip to content

Instantly share code, notes, and snippets.

@ashwin
Created May 3, 2012 23:15
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 ashwin/2590326 to your computer and use it in GitHub Desktop.
Save ashwin/2590326 to your computer and use it in GitHub Desktop.
eval in Python
x = 1
y = eval( "x + 1" ) # 2
f = eval( "lambda x: x * x" )
g = f( 10 ) # 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment