I had to write an narry function and it took me 1 hr to write it

def n_ary(f):
    def n_ary_f(x, *args):
        if len(args)==0:
            return x
        elif len(args)==1 :
            return f(x,args[0])
        else :
            return f(x, n_ary_f(args[0], * tuple([c for c in args][1:]) ))
    return n_ary_f

all I had to do was to write one line of code

def n_ary(f):
    def n_ary_f(x, *args):
        return x if not args else f(x,n_ary_f(*args))
    return n_ary_f

vin = n_ary(test)
print vin(*range(10))