r/Python • u/fuzz3289 • Feb 28 '13
What's the one code snippet/python trick/etc did you wish you knew when you learned python?
I think this is cool:
import this
259
Upvotes
r/Python • u/fuzz3289 • Feb 28 '13
I think this is cool:
import this
3
u/[deleted] Feb 28 '13
Yes. It ensures that the file is closed/the mutex is released, even if there's an exception while the inner code is being executed.
It's a context manager, if you want to look up more details.