Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Use with everywhere to open files #397

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alcrene
Copy link
Contributor

@alcrene alcrene commented Apr 21, 2024

As far as I know, there is no advantage to using f = open() ... f.close() when with open() as f: will do. The with form deals better with corner cases where program execution ends unexpectedly, and is generally more Pythonic.

As far as I know, there is no advantage to using `f = open() ... f.close()
when a `with open() as f:` will do. The `with` form deals better with
corner cases where program execution ends unexpectedly, and is
generally more Pythonic.
@alcrene alcrene changed the title Use with everywhere to open files Fix: Use with everywhere to open files Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant