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 中调试时如何避免进入内置函数?
基础教程推荐
- Discord.py 缺少必需的参数 2022-01-01
- numpy float:比算术运算中内置的慢 10 倍? 2022-01-01
- 由Python将MP3转换为MIDI(类型错误:无法加载插件:mtg-Melodia:Melodia) 2022-01-01
- 与常规 dict 相比,Python manager.dict() 非常慢 2022-01-01
- 尝试制作WhatsApp机器人 2022-01-01
- 在 Celery 工作人员中捕获 Heroku SIGTERM 以优雅地关 2022-01-01
- 使用生成器和迭代器时 Python 多循环失败 2022-01-01
- 将 x 轴刻度更改为自定义字符串 2022-01-01
- 用 Python 编写 Fortran 无格式文件 2022-01-01
- pyserial - 可以从线程 a 写入串行端口,是否阻塞从线程 b 读取? 2022-01-01
