摘要: ##staticmethod staticmethod 只能作为函数装饰器应用。其作用为将一个函数转换为静态方法。下面一段代码中,若不在def get(argv1)上添加装饰器staticmethod. 在执行代码test.get("hello") 将会出现 TypeError: get() tak 阅读全文
posted @ 2020-12-23 14:28 徐徐前行 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 最近看Robotframe中SeleniumLibrary 源码,发现源代码中存在许多@property,因此看下python中内置的装饰器。 简言之,python 内置的装饰器常见为3个 ,分别为@property 、@classmethod和@staticmethod。 ##property 源 阅读全文
posted @ 2020-12-23 11:09 徐徐前行 阅读(168) 评论(0) 推荐(0) 编辑