Skip to content

Instantly share code, notes, and snippets.

@mutsune
Created June 6, 2014 06:42
Show Gist options
  • Save mutsune/538a714e54d075be2d8b to your computer and use it in GitHub Desktop.
Save mutsune/538a714e54d075be2d8b to your computer and use it in GitHub Desktop.
Python で制御構造っぽいものを定義
def repeat(n):
def _repeat(f, *args):
[ f(*args) for i in xrange(n)]
return _repeat
def _print(text):
print text
repeat(10)(_print, "hoge")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment