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
.
精彩评论