更一般一些:
def composed(*decs): def deco(f): for dec in reversed(decs): f = dec(f) return f return deco
然后
@composed(dec1, dec2)def some(f): pass
@dec1@dec2def some(f): pass
欢迎分享,转载请注明来源:内存溢出
更一般一些:
def composed(*decs): def deco(f): for dec in reversed(decs): f = dec(f) return f return deco
然后
@composed(dec1, dec2)def some(f): pass
@dec1@dec2def some(f): pass
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)