Replies: 2 comments 2 replies
-
Perfectly normal. You'll find plenty of example using files with something like: with open("some_file", "w") as f:
f.write("hello world") |
Beta Was this translation helpful? Give feedback.
0 replies
-
Right, but you don't usually see with open("some_file", "w") as f:
f.write("hello world")
assert(f.closed) But I guess there's no problem with it. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Now I'm wondering whether it might be better to use
results
as the name of the attribute collecting the return values.Also, it's now striking me as odd to reference the context manager object (
c
in the example code) outside of thewith
statement context. I think I've just never seen a use of awith
statement like that. Does that seem fine to others?Beta Was this translation helpful? Give feedback.
All reactions