python function wrapping not working -
i got example on https://www.youtube.com function wrapping ,but throw exception.
def addone(myfunc): def addoneinside(myfunc): return myfunc()+1 return addoneinside def oldfunc(): return 3 oldfunc=addone(oldfunc) print oldfunc()
error :
typeerror: addoneinside() takes 1 argument (0 given)
can body explain problem.
addoneinside
not need argument. myfunc
accessible via context.
change
def addone(myfunc): def addoneinside(): return myfunc()+1 return addoneinside
Comments
Post a Comment