ipdb调试器,退出循环

Jav*_* C. 16 python debugging ipdb

是否有一个命令可以在ipdb上调试时逐步退出循环(例如,for或while)而不必使用断点?

我使用until命令跳出列表推导,但不知道如果可能的话,我怎么能做整个循环块的类似事情.

ams*_*ree 19

你可以j <line number> (jump)用来转到另一条线.例如,j 28去第28行.

  • 正如 jimifiti 所指出的,`jump` 会跳过跳转的行,所以它与 `until` 不相似 (3认同)

Joh*_*ann 14

我相信这是until命令的意图.它类似于a,next除了当循环的前一个行号发生跳转时,它将继续直到退出循环.

unt(il)
Continue execution until the line with a number greater than the current
one is reached or until the current frame returns
Run Code Online (Sandbox Code Playgroud)

一般来说,要"走出"当前功能,请使用return.

r(eturn)
Continue execution until the current function returns.
Run Code Online (Sandbox Code Playgroud)


jim*_*iki 7

听起来很明显:跳跃让你跳跃.这意味着您不执行跳转的行:您应该使用它来跳过您不想运行的代码.

您可能需要tbreak(临时断点,当它第一次被命中时会被自动删除.参数与break相同)就像我在找到此页面时所做的那样.