简体   繁体   English

如何高效调试Python内置模块?

[英]How to Debug Python built-in module efficiently?

recently I'm learning Python standard library and reading the source code最近我在学习 Python 标准库并阅读源代码

help for understanding I copy code segment and paste to python interpreter帮助理解我复制代码段并粘贴到python解释器

but I feel it's inefficient and unwise ('cause import module won't got the _ )但我觉得它效率低下且不明智(因为导入模块不会得到_

I wanna to find a efficient way to test a module, include the _var and _func()我想找到一种有效的方法来测试模块,包括 _var 和 _func()

thanks for any good idea -- a green man谢谢你的好主意——一个绿色的人

The module pdb is an interactive source code debugger for Python programs.模块pdb是 Python 程序的交互式源代码调试器。

import pdb
pdb.set_trace() #  insert this line at the location you want to break

Documentation is provided here : pdb此处提供文档: pdb

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM