Python , , , . , (, , ). , .
Python , Python , , ( ), .
, , .
, :
@my_decorator
def my_function()
print("My_function")
:
def my_function()
print("My_function")
my_function = my_decorator(my_function)
def my_decorator(func):
print("decorated)
return 42
my_function , ( print(my_function))
,
def my_decorator2(some_fun):
print("before")
some_fun()
print("after")
( python , None).
@my_decorator2
def decorated():
print("inside")
before
inside
after
decorated() 'NoneType' object is not callable, decorated None.
, - , ( "wrap" ). - , /, - .