First page Back Continue Last page Overview Image

Attribute gehen verloren

def greeting(func):

def function_wrapper(x):

""" function_wrapper of greeting """

print("Hi, " + func.__name__ + " returns:")

return func(x)

return function_wrapper

@greeting

def f(x):

""" just some silly function """

return x + 4

f(10)

print("function name: " + f.__name__)

print("docstring: " + f.__doc__)

print("module name: " + f.__module__)

Hi, f returns:

function name: function_wrapper

docstring: function_wrapper of greeting

module name: __main__