Transition by operator of profitability

When in the Python debugger (pdb) I want to switch to the yield statement, but pressing (n) for the next brings me to the profit destination, that is, the consumer of the generator. I want to go to the next line that runs in the generator. Is there any way to do this?

I am using Python 2.6

+4
source share
2 answers

If your debugger allows you to use breakpoints and change the values โ€‹โ€‹of variables when you are there, it is as simple as [in pseudocode]

Set Boolean yieldValue to true; [breakpoint after that line is executed, you can set yieldValue to false here] if yieldValue, yield value; in other words: bool yieldValue = true; [breakpoint here] if(yieldValue) yield value; 

Note that you usually cannot fix a breakpoint on an empty line. However, you will have to stick with it before the if statement.

-1
source

In debuggers, you usually want to "pass" (s) to a function in this case, rather than "next" (n).

"Next" executes the next line in the area you are looking at; "step" takes you to the next area down, the generator in this case, which sounds the way you want.

-1
source

Source: https://habr.com/ru/post/1310665/


All Articles