The wrapped function doesn't get the arguments of the original function. It gets arguments that it can (and usually does) choose to pass on to the original function.
When you do myprint = makeitalic(myprint)
, the name myprint
now refers to the wrapped function. It no longer refers to the function defined earlier as myprint
.
So, when you call myprint('hii')
, you are calling the wrapped function. The original function has no arguments yet because it has never been called.
Inside wrapped
, you make a call to f
. This is the original function, and you pass it args[0]
, which is 'hii'
. So, now the original function is called. It gets the first argument of the wrapped function, because that's what you chose to pass it.