【发布时间】:2010-10-13 04:01:34
【问题描述】:
如果我有一个功能:
@aDecorator
def myfunc1():
# do something here
if __name__ = "__main__":
# this will call the function and will use the decorator @aDecorator
myfunc1()
# now I want the @aDecorator to be replaced with the decorator @otherDecorator
# so that when this code executes, the function no longer goes through
# @aDecorator, but instead through @otherDecorator. How can I do this?
myfunc1()
是否可以在运行时替换装饰器?
【问题讨论】:
标签: python runtime language-features decorator