Skip to content

Instantly share code, notes, and snippets.

@hanepjiv hanepjiv/
Last active Aug 29, 2015

What would you like to do?
# coding: utf-8
from functools import wraps
# ================================================
def choice(a_Func):
# --------------------------------------------------------------------------
def loop(*args):
if len(args) is 0:
return []
if len(args[1:]) is 0:
return [[i] for i in args[0]]
return [[i] + j for i in args[0] for j in loop(*args[1:])]
# --------------------------------------------------------------------------
def wrapper(*args):
return [i for i in map((lambda args: a_Func(*args)), loop(*args))]
return wrapper
def hoge(*args):
return tuple(args)
print(hoge((0,), (1,2), (3,4,5), (6,7,8,9)))
def fuga(*args):
return sum(args)
print(fuga((0,), (1,2), (3,4,5), (6,7,8,9)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.