Вопрос

Simple and maybe obvious but not for us yet:
Using pdb shortcuts becomes annoying when there are same name variables to the commands, therefore, how to remove all key shortcuts in pdb? We use pdb in spyder, BTW.

>>> p = 1

while trying to debug the above p appears as command (abr. for print) while we are interested in our variable! Confusing!

Это было полезно?

Решение

(Spyder dev here) According to the documentation you need to prefix variable names with ! if their names are the same that pdb commands. That's the easy way to solve your problem.

The hard way is to define your own sitecustomize, subclass pdb.Pdb and redefine it's do_p, do_d, do_b methods to print your variables. You can check out how we subclass pdb.Pdb for our own purposes here, in case you want to follow this path.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top