osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

transform a "normal" decorator in one for async functions


Il giorno marted? 18 settembre 2018 17:36:16 UTC+2, vito.d... at gmail.com ha scritto:

> > > is there a way to "convert" a "normal" decorator in one that can handle async functions?
> > In general? No.
> Ouch.
> 
> I'm new to the "async" world, but so this mean that all of the (appliable) decorators present in the various libraries have to be "paired" with async versions?

I was also thinking: there are some decorator functions (and decorator functions factories) also in the stdlib (functools.wrap, property, classmethod ... you name it)
so this means that also we need to check each of them if is applyable to async functions?