So i\'m trying to make a function that keeps track how many times a method is called. for example:
a = [1,2,3,4] a.pop()
i want to know how
i used the following little trick to track how many times the function was called
def myfun(s,i=[0]): print(s) i[0]+=1 # mutable variable get evaluated ONCE return i[0] >>> myfun('aaa') aaa 1 >>> myfun('bbb') bbb 2