2 ms·
> See Python files, which are closed when the file handle is collected (ie. when all variables holding it go out of scope) That's a CPython implementation deta
by nemetroid 2y ago
> See Python files, which are closed when the file handle is collected (ie. when all variables holding it go out of scope)
That's a CPython implementation detail.
https://docs.python.org/3/reference/datamodel.html https://docs.python.org/3/reference/datamodel.html
> Do not depend on immediate finalization of objects when they become unreachable (so you should always close files explicitly).