搜索
您的当前位置:首页正文

name mangling

来源:二三娱乐
[root@shuffle-dev py_test]$ vim sf_namemangling.py 
 17 class C(A):
 18     def __init__(self):
 19         self.__private()
 20         self.public()
 21     @classmethod
 22     def __private(cls):
 23         print 'C.private'
 24     @staticmethod
 25     def public():
 26         print 'public'
 27 
 28 print '---create b---'
 29 b=B()
 30 print '---create c---'
 31 c=C()
 32 print '---method of class C---'
 33 C._C__private()                                                                                          
 34 C.public()
[root@shuffle-dev py_test]$ ./sf_namemangling.py 
---create b---
A.private()
B.public
---create c---
C.private
public
---method of class C---
C.private
public
Top