I'm profiling a Python function `foo()` that takes a single argument,
but that argument makes a huge difference in what the function
actually does.
Currently I'm using `cProfile`, which records every call to `foo()` as
if it was the same, preventing me from figuring out what's going on.
Is there
Consider a simple call graph: `main()` calls `foo()`, which calls
`bar()`. Then `main()` calls `qux()` which also calls `bar()`, but
with different parameters.
When you run the above through cProfile and view the result in
SnakeViz, you will see `main()` calling `foo()` and `qux()`, with each
of t
Suppose we write a very simple bi-directional generator in Python:
def share_of_total():
s = 0
new_num = 0
while True:
new_num = yield new_num / (s or 1)
s += new_num
share_calculator = share_of_total()
next(share_calculator) # Without