Original Sources:
Used in this file:
~ Ex.: Declaration
def decorator(argument):
def real_decorator(function):
def wrapper(*args):
for arg in args:
assert type(arg)==int,f'{arg} is not an interger'
result = function(*args)
result = result*argument
return result
return wrapper
return real_decorator~Ex.: Usage of the decorator:
@decorator(2)
def adder(*args):
sum=0
for i in args:
sum+=i
return sum~Es.: Use of the function:
adder(2,3) #Returns 10
adder('hi',3) #Returns AssertionError