正如标题所说——默认的(Pdb)提示符怎么改成别的东西呢? built-in 似乎没有根据 docs or source.
(Pdb)
一种解决方法是在 .pdbrc 中动态设置它,例如
.pdbrc
!(lambda: exec('import gc, pdb; next(o for o in gc.get_objects() if isinstance(o, pdb.Pdb)).prompt = "pdb> "', {}))()
这会导致提示“pdb>”。这也避免了污染本地范围。
pdb>
或者,使用另一个调试器,例如 pdb++ for which the prompt and other attributes can be configured (per here)。