A number of languages have With statements. The Python with statement creates a new context, with associated context manager. When the context (a code block) is exited again, the context manager is notified. Please use "common-table-expression" for the SQL WITH construction.
A number of languages have With
statements. Python's with
statement creates a runtime context, defined by a contextmanager. As the code block under the with
statement is entered, a __enter__
hook is called on the context manager, and as it is exited (by any means, including exceptions and return statements), the __exit__
hook is called.
Python provides several standard context managers. File objects, for example, can be opened as a context manager, and on exit the file is automatically closed.
Context managers were defined in PEP 343.
Please use common-table-expression for the SQL WITH
statement