News for hackers. Stuff that matters.
Re:Show HN: Refurb – A tool for refurbishing and modernizing... by nicolaslem on Wednesday September 28, 2022 @10:52AM (#33008660)
> the file will be reliably closed at the end of the statement.

The only guarantee CPython makes is that it may eventually close the file once all references are gone. The fact that it does it immediately and reliably in this specific case is an implementation detail and should not be relied upon.

Use context managers when things need to be closed and save yourself trouble down the line.

There are no comments on this comment yet.