摘要: 今天看了下python的一些基本语法,首先给大家举个列子吧对于函数__call__,其首先需创建一个对象,然后通过此对象来调用call函数,如下api=API()api()而对于@staticmethod和@classmethod,两者之间的最大区别在在于被两个参数装饰的函数,是否需要传递隐式的传递类名,如上如果把factory函数的装饰器换成static的,则其参数cls需要删之。 阅读全文
posted @ 2013-05-26 22:57 SA高处不胜寒 阅读(464) 评论(0) 推荐(0) 编辑
摘要: class base(object):def help1(self,object1, spacing,collapse=1):"""Print method and doc string.Takes module, class, list, dictionary, or string."""typeList = (BuiltinFunctionType, BuiltinMethodType, FunctionType, MethodType, ClassType)methodList = [method for method in d 阅读全文
posted @ 2013-05-26 16:26 SA高处不胜寒 阅读(286) 评论(0) 推荐(0) 编辑