【发布时间】:2017-12-24 01:31:06
【问题描述】:
我使用 PyCharm 社区版 3.4。
我已将self.__a 添加到手表。
这是我的例子:
class Box:
def __init__(self, a, b, c):
self.__a = a
self._b = b
self.c = c
d = 0 #Breakpoint.
a = Box(1, 2, 3)
所以,我开始调试并在断点处停止。 self.__a 手表显示 {AttributeError}'Box' object has no attribute 'a'.
我按下 Alt + F8 并计算 self.__a = a。结果是None。
然后我评估self.__a,结果是1。
我的self.__a 手表仍然显示{AttributeError}'Box' object has no attribute 'a'。我删除它。然后我添加另一个手表self.__a。它显示1。
你能解释一下这里发生了什么吗?
【问题讨论】: