5 ms·
It depends on how you use it! If you use it to acquire the resource, as in with open(fn, 'r'): ... then generally the answer is no, since that is
by kqr 11y ago
It depends on how you use it! If you use it to acquire the resource, as in
with open(fn, 'r'):
...
then generally the answer is no, since that is the same thing as the equivalent `try…finally`. If someone removes the file after it's being opened it will not be completely wiped until it's closed.