Python:类中的私有方法

类中的私有方法

在Python中使用___开头的方法名称,表示方法对类是“私有的”,而不是由外部程序使用的。

例如

class Test:
    def __init__(self):
        pass
     
    def __privateMethod(self):
    	pass
posted on 2021-01-31 00:28  摸鱼time  阅读(605)  评论(0)    收藏  举报