Aug-13-2018, 08:58 AM
hi,
I am learning decorators and trying to run this code but when i run it it says following error:
I am learning decorators and trying to run this code but when i run it it says following error:
Error:Traceback (most recent call last):
File "D:\Learnpython\hard way python\decoratorss.py", line 138, in <module>
var(**d)
File "D:\Learnpython\hard way python\decoratorss.py", line 131, in wrapper
return anys(*args, **kwargs)
TypeError: 'list' object is not callable
this is my code:def main(anys): def wrapper(*args, **kwargs): for k,v in kwargs.items(): print(f"Key is {k} and value is {v}") return anys(*args, **kwargs) return wrapper def getsquare(n): return [i**2 for i in range(n)] var = main(getsquare(100)) d = {"d":1, "c":2, "f":3} var(**d)can anybody please explain what am i doing wrong