本文介绍了PyCharm:调试:r(eturn)继续执行直到当前函数返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

pdb调试器具有一个不错的功能:

The pdb Debugger has a nice feature:


  • r(eturn)继续执行直到当前函数返回。

如果一个方法有多个return语句,这将很方便。

This is handy if a method has several return statements.

使用此功能,您可以看到

With this feature you can see where the method would get left, but you still see which return statement gets used.

pdb调试器在如下代码行处停止:

The pdb Debugger stops at a code line like this:

    return foo

我可以

是否可用,或者这是一项功能请求?

Is it available, or it this a feature request?

推荐答案

如果知道返回值就足够了(不知道确切地触发了哪个return语句),则可以尝试以下操作:

If knowing the return value is enough (without knowing which return statement was exactly triggered), you can try this:


  1. 在调试器窗口中单击齿轮,并确保已选中显示返回值

  2. 退出函数后,您会在Var中看到一个新项iables窗格称为返回值,并返回值。

  1. In the Debugger window click the cogwheel and make sure Show Return Values is checked.
  2. After you Step Out of the function, you'll see a new item in the Variables pane called Return Values, with the value returned.

这篇关于PyCharm:调试:r(eturn)继续执行直到当前函数返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 16:06