I'm very unfamiliar with Python 2.x and I have some inherited code in many files where I need to count how many times some particular functions are called (to solve a particular problem).
To show what I mean, in another simple language I would do this
Add at the beginning of the code
counter_funcA = 0
counter_funcB = 0
...
In the beginning of function A
counter_funcA += 1
In the beginning of function B
counter_funcB += 1
And so on...
And at the end
print counter_funcA
...
So how would a python expert do this in a nice way?
I guess the operation +=
is quite atomic -- so there will not be any concurrency issues?