Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix whitespaces
  • Loading branch information
heckad committed Oct 31, 2020
commit 1bace398398b36ddc0be4dc063dcb27e0068e94e
12 changes: 6 additions & 6 deletions Doc/library/contextlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,16 @@ Functions and classes provided:

Context managers defined with :func:`asynccontextmanager` can be used
either as decorators or with :keyword:`async with` statements::

import time
async def timeit():

async def timeit():
now = time.monotonic()
try:
yield
finally:
print(f'it took {time.monotonic() - now}s to run')

@timeit()
async def main():
# ... async code ...
Expand Down Expand Up @@ -377,11 +377,11 @@ Functions and classes provided:


.. class:: AsyncContextManager

Similar as ContextManger only for async
Comment thread
heckad marked this conversation as resolved.

Example of ``ContextDecorator``::

from asyncio import run
from contextlib import AsyncContextDecorator

Expand Down