运维网's Archiver
论坛
›
Python
› python 类装饰器
gaoke
发表于 2017-5-1 07:59:09
python 类装饰器
#!coding=utf-8
registry = {}
def register(cls):
registry = cls
return cls
@register
class Foo(object):
__clsid__ = '123-456'
def bar(self):
pass
print registry
页:
[1]
查看完整版本:
python 类装饰器