How to avoid step into built-in functions when debugging in PyCharm?(在 PyCharm 中调试时如何避免进入内置函数?)
问题描述
例如:
df = load_dataset(os.path.join(os.path.dirname(dataset), "aclImdb"))我不想调试 dirname 和 join,因为它们是 Python 内置函数,但只想调试用户定义的函数,如 load_dataset.
有没有办法在 PyCharm 中控制它?
当你按下
以下是仅使用标准库的代码示例,可复制用于测试
导入操作系统定义我的函数():返回 2my_str = str(os.path.join(os.getcwd(), str(my_function())))此屏幕截图显示使用 Step into F7 未选中 Do not step into library scripts 和 Always do smart step into代码>已检查.
注意 3 个设置选项是相互关联的,如果您选择 Do not step into library scripts 和 Always do smart step into IDE 仍然会给您一个选择进入库函数.如果您取消选中后一个选项,上述示例将自动进入您的函数.
For example:
df = load_dataset(os.path.join(os.path.dirname(dataset), "aclImdb"))
I don't want to debug dirname and join, since they are Python built-in functions, but only want to debug user defined functions like load_dataset.
Is there a way to control that in PyCharm?
It's possible to stop the debugger from stepping into library functions when you press Step into F7 bu going to File > Settings > Build, Execution, Deployment > Debugger > Stepping > Python and checking the option Do not step into library scripts.
(One alternative could also be using Step into my code Alt + Shift + F7).
As shown in the screenshot.
The following is a code example using only standard library that can be copied for testing
import os
def my_function():
return 2
my_str = str(os.path.join(os.getcwd(), str(my_function())))
This screenshot shows using Step into F7 having Do not step into library scripts unchecked and Always do smart step into checked.
Notice the 3 setting options are interconnected, if you choose Do not step into library scripts together with Always do smart step into the IDE will still give you a choice to step into the library function. If you uncheck the later option the above example will automatically step into your function.
这篇关于在 PyCharm 中调试时如何避免进入内置函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 PyCharm 中调试时如何避免进入内置函数?
基础教程推荐
- 在 Python 中将货币解析为数字 2022-01-01
- 在 Django Admin 中使用内联 OneToOneField 2022-01-01
- 究竟什么是“容器"?在蟒蛇?(以及所有的 python 容器类型是什么?) 2022-01-01
- kivy 应用程序中的一个简单网页作为小部件 2022-01-01
- Python 中是否有任何支持将长字符串转储为块文字或折叠块的 yaml 库? 2022-01-01
- Kivy 使用 opencv.调整图像大小 2022-01-01
- matplotlib 设置 yaxis 标签大小 2022-01-01
- 对多索引数据帧的列进行排序 2022-01-01
- Python,确定字符串是否应转换为 Int 或 Float 2022-01-01
- 比较两个文本文件以找出差异并将它们输出到新的文本文件 2022-01-01
