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

jquery - How do you format the date used in the popover widget title of FullCalendar? -

Bubble Sort Manually a Linked List in Java -

asp.net mvc - SSO between MVCForum and Umbraco7 -