我是想看看我能不能叫蟒蛇類的私有函數,我想在IPython中:python類未能提供_Secretive__xxx()函數,爲什麼?
In [14]: class C:
....: def __my(s):
....: print "hello"
....:
In [15]: print C
__main__.C
In [16]: obj=C()
In [17]: obj._Secretive__my
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-17-c68d82fedeb4> in <module>()
----> 1 obj._Secretive__my
AttributeError: C instance has no attribute '_Secretive__my'
In [18]: obj._Secretive__my()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-18-ab4a9965f82a> in <module>()
----> 1 obj._Secretive__my()
嗯,看來我無法統計,或調用它,對嗎?我哪裏錯了?