+ 1
This is where am getting error messages every time. my answer here is @my_dec
Which statement can be used to achieve the same behavior as my_func = my_dec(my_func)? @my_dec my_func = @my_dec my_dec(my_func)
1 Answer
+ 2
Here, my_func = @my_dec, this syntax is not valid in Python. You cannot directly assign a decorator to a function in this manner. Also, my_dec(my_func), this line directly calls the decorator my_dec with my_func as an argument, which is not how decorators are typically used. You can write as follows:
@my_dec
def my_func():
pass