decorator 4.1 is out

Michele Simionato michele.simionato at
Sat Jul 15 09:33:08 EDT 2017

Dear all,

a new release of the decorator module is out. For the first time we support decorating Python 3.5 coroutines. For instance, this is an example of how to implement a tracing decorator called log_start_stop that you can use for debugging:

import time
import logging
from asyncio import get_event_loop, sleep, wait
from decorator import decorator

async def log_start_stop(coro, *args, **kwargs):'Starting %s%s', coro.__name__, args)
    t0 = time.time()
    await coro(*args, **kwargs)
    dt = time.time() - t0'Ending %s%s after %d seconds', coro.__name__, args, dt)

async def make_task(n):
    for i in range(n):
        await sleep(1)

if __name__ == '__main__':
    tasks = [make_task(3), make_task(2), make_task(1)]

You will get an output like this:

INFO:root:Starting make_task(1,)
INFO:root:Starting make_task(3,)
INFO:root:Starting make_task(2,)
INFO:root:Ending make_task(1,) after 1 seconds
INFO:root:Ending make_task(2,) after 2 seconds
INFO:root:Ending make_task(3,) after 3 seconds

Also, for the first time the documentation is hosted on
Here are the relevant links:


More information about the Python-announce-list mailing list