Skip to content

Instantly share code, notes, and snippets.

@liuhuajin
Created August 2, 2015 06:43
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 liuhuajin/7facd877ff3d23672795 to your computer and use it in GitHub Desktop.
Save liuhuajin/7facd877ff3d23672795 to your computer and use it in GitHub Desktop.
一个经典的闭包示例
def too_big(limit):
def compare(x):
return x > limit
return compare
f = too_big(100)
print f(100)
print f(101)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment