python - TypeError: 'NoneType' object is not callable in factory function -
#!/usr/bin/python def maker(n): def action(x): return x*n return action f=maker(2) print f(3)
i have problem here type error.how solve 2 arguments problem,one fixed.
you need put return action
out of action
function :
def maker(n): def action(x): return x*n return action f=maker(2) print f(3)
result:
6
note in factory function must return inner function result of main function.
Comments
Post a Comment