python - 方便地在 Python 的调试器(pdb)中启用多行语句的执行

标签 python debugging vim

正在运行 !import code; code.interact(local=vars())pdb里面prompt 允许您在调试器中输入多行语句(例​​如类定义)(source)。 有什么方法可以避免每次都复制粘贴/键入整行?

我在想Conque对于 vim并设置类似 :noremap ,d i!import code; code.interact(local=vars())<Esc> 的内容但在插入模式之外编辑任何内容似乎对提示没有任何影响。

最佳答案

PDB 在启动时读取 .pdbrc。来自Python docs :

If a file .pdbrc exists in the user’s home directory or in the current directory, it is read in and executed as if it had been typed at the debugger prompt. This is particularly useful for aliases. If both files exist, the one in the home directory is read first and aliases defined there can be overridden by the local file.

因此请尝试创建该文件并将该命令按原样放入其中。

关于python - 方便地在 Python 的调试器(pdb)中启用多行语句的执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15078087/

相关文章:

css - 如何定义一组 CSS 类名以便 Vim 知道如何自动完成

vim - 在vim中自动完成隐藏文件

python - 在正则表达式交替中匹配最长字符串的保证方法

python - 如何使用 Django 使递归多对多关系对称

python - 无法 reshape 包含 PNG 图像的 numpy 数组

python - ftplib.cwd 错误 : UnicodeEncodeError: 'latin-1' codec can't encode characters

c++ - 调试断言失败 : invalid iterators

java - 进程死后如何使用异常堆栈跟踪

python 条件调试断点单行代码,适用于 3.7 PEP 553 之前的版本,其行为类似于 Perl 的 $DB::single=1

java - 如何获取maven依赖源并解压到指定目录?