-1

friends
I am newbee in a python and i have some problems with IDLE on Windows I try to write some code like this but have an error

def n_ary(f):
        def n_ary_f(x, *args):
            return f(x) if not args else f(x, n_ary_f(args[0], args[1:]) # problem  there
        return n_ary_f  #but IDLE underline return

Can anybody explain me how I can have more descriptive error message in IDLE?

4

1 回答 1

2

您在第三行缺少右括号。只需添加它:

return f(x) if not args else f(x, n_ary_f(args[0], args[1:]))
#                                                           ^
于 2012-10-28T20:24:06.250 回答