micheles/decorator

Decorator not calling at all times

NithishReddy opened this issue · 1 comments

class Decorator:
def init(self):
self.x = x
self.y = y
def call(self, func):
def inner(*args, **kwargs):
result = self.function(*args, **kwargs)
print("Exceting in Decorator")
# after function
return result
return inner

adding class decorator to the function

@decorator(x=5, y =6)
def get_square(n):
print("Executing step1")

print in function displaying but print in decorator class is not displaying.
output: Executing step1

I think as you defined the class name as Decorator and you are calling the class with @decorator. It seems your code breaks because of the difference in D and d