3 ms·
Plain context manager doesn't actually introduce a new scope: with open("foo") as f: s = f.read() print(f) # closed file object still exists A
by andreareina 4y ago
Plain context manager doesn't actually introduce a new scope:
with open("foo") as f:
s = f.read()
print(f) # closed file object still exists
A macro that looks like a context manager would work but beware the edge cases.