Skip to content

Instantly share code, notes, and snippets.

@pasberth
Created October 18, 2011 07:19
Show Gist options
  • Save pasberth/1294800 to your computer and use it in GitHub Desktop.
Save pasberth/1294800 to your computer and use it in GitHub Desktop.
カリー化で可変長引数っぽい事
def curryargs(arg=None, args=()):
def _ca(next=None):
return curryargs(next, args + (arg,))
if arg:
return _ca
else:
return args
def printargs(args):
for arg in args:
print(arg)
printargs(curryargs("1")("2")())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment