User Tools

Site Tools


aexit

__aexit__()

object.__aexit__(self, exc_type, exc_value, traceback)

This Python method is semantically similar to the __exit__(), with only difference that it must return an awaitable.

An example of an asynchronous context manager class:

class AsyncContextManager:

   async def __aenter__(self):
       await log('entering context')
   async def __aexit__(self, exc_type, exc, tb):
       await log('exiting context')

New in version 3.5.

Fair Use Source: https://docs.python.org/3/reference/datamodel.html#object.__aexit__

aexit.txt · Last modified: 2020/11/20 01:06 by 127.0.0.1