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

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -