3 ms·
FWIW many objects in Python (including files) also close themselves when they are deleted (either explicitly or implicitly when their reference count drops to 0
by nerdponx 7y ago
FWIW many objects in Python (including files) also close themselves when they are deleted (either explicitly or implicitly when their reference count drops to 0). Usage of "with" for files is more of a "just in case" idiom than a necessity.