3 ms·
I think inglor refers to the new 'async with' statement: https://docs.python.org/3/reference/compound_stmts.html#async-with https://docs.python.org/3/reference/
by 1st1 11y ago
I think inglor refers to the new 'async with' statement: https://docs.python.org/3/reference/compound_stmts.html#async-with https://docs.python.org/3/reference/compound_stmts.html#asyn...
Using it you can safely cleanup/commit transaction/release lock/etc when exiting a block of statements (even if an exception was raised). Plain 'with' statement cannot call asynchronous code in '__exit__' methods, 'async with' can do that (in '__aexit__').