开发者

print values in pdb

Wh开发者_如何学JAVAen I trace to a function, inside the function I would like to print the values of those variable names with underscore in the beginning, eg. p __seqLen. It keeps showing AttributeError: AttributeError("Converter instance has no attribute '__seqLen'",) I also tried to use p self.__seqLen. This is also not working. How can I print those values?


p locals()
p globals()

could help.


You might be running into Python's private name mangling. Python will mangle identifiers that begin with two or more underscores and do not end with two or more underscores. It transforms __somename into _Class__somename.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜