Est-il possible de remplacer une fonction/méthode de décorateur au moment de l'exécution? [ python ]

Si j'ai une fonction :


@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()

Est-il possible de remplacer un décorateur au moment de l'exécution?

InformationsquelleAutor Geo | 2009-03-13