6 ms·
What is async resource management? can you link to docs for the features you mean? I'm having trouble googling this one, maybe different keywords are used?
by ColinDabritz 11y ago
What is async resource management? can you link to docs for the features you mean? I'm having trouble googling this one, maybe different keywords are used?
- 1st1 11y agoI 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__').