Python:__init__中的var set不可用

时间:2017-09-25 09:55:26

标签: python django

我无法理解调试器中的以下行为:

(Pdb++) ll
58         def __init__(self, content=None):
59             import pdb; pdb.set_trace()
60             self.__content = BytesIO()
61             self.__len = 0
62  ->         self.read_started = False
63             if content is not None:
64                 self.write(content)
(Pdb++) !self.__len
 *** AttributeError: 'FakePayload' object has no attribute '__len'

相反,我可以证明该对象具有这样的属性:

(Pdb++) fpl = environ['wsgi.input']
(Pdb++) fpl._    -> <TAB-TAB>
_FakePayload__len

我之前从未见过这样的事情,我很高兴有任何暗示让我理解。

0 个答案:

没有答案