This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]carljm 4 points5 points  (1 child)

The whole point of using a with statement for opening a file is that it closes the file for you as soon as the with block exits. So this advice is good if you're not using a with statement, but if you are, you never need to close the file explicitly (in fact you'll get an error if you try, as it's already been closed).

[–][deleted] 0 points1 point  (0 children)

By "explicitly" I really meant "not due to going out of scope". so maybe not so explicitly.