Glossary: Refactoring and Clean Code
with statement
Also written: with open, context manager
A Python block, as in `with open(path) as file:`, that closes the file automatically when the block ends, even if an error occurs. The old script's `open(f)` without `with` never closes the file.