在Python编程中经常会遇到函数(function),方法(method)及属性(attribute)以下划线'_'作为前缀,这里做个总结. 主要存在四种情形: 1. object # public 2. __object__ # special, python system use, user should not define like it 3. __object # private (name mangling during runtime) 4. _object # obey pyt
add by zhj:今天在学习SimpleHTTPServer的源代码时,看到了Python标准库SocketServer模块中有个BaseServer类,该类的__init__方法定义如下 def __init__(self, server_address, RequestHandlerClass): """Constructor. May be extended, do not override.""" self.server_addres