摘要: 问题描述:我也是在读500 Line 里满的DBDB 的代码时发现的,python的父类可以调用子类的方法,这跟平常习惯的理解方式很不一样,所以就查了下原因,记录如下: 1、现象:最近使用到了SocketServer.py 这个包,就顺便学习一下它的实现,在阅读的过程中,发现BaseServer 中 阅读全文
posted @ 2017-01-15 22:17 HelloSUN 阅读(11646) 评论(0) 推荐(0) 编辑
摘要: Python中3种方式定义类方法, 常规方式, @classmethod修饰方式, @staticmethod修饰方式. class A(object): def foo(self, x): print("executing foo(%s,%s)" % (self, x)) print('self: 阅读全文
posted @ 2017-01-15 19:55 HelloSUN 阅读(337) 评论(0) 推荐(0) 编辑