John Belmonte <j...@neggie.net> added the comment:

I have a context manager used for timing sections of code or whole functions 
(when used as a decorator).  It's aware of the Trio async/await scheduler and 
is able to exclude periods of time where the task is not executing.  The 
context manager itself is not async.

Synopsis of decorator case:

  @PerfTimer('query')
  async def query_or_throw(self, q):
      return _parse_result(await self._send_query(q))

I'd like to just use the existing ContextDecorator to define the PerfTimer 
context manager, and have it wrap coroutine functions properly.  New API is not 
required.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37398>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to