Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2
I'm tempted to think so based on an explanation for the 'guard' function used to implement 'with...open': http://effbot.org/zone/JUMP_LINK__&&__python__&&__JUMP_LINK-with-statement.htm It seems to be preferred because files still close on exceptions: http://docs.quantifiedcode.com/python-code-patterns/maintainability/not_using_with_to_open_files.html Admittedly: I'm not able to verify exceptions right now but I'll keep an eye out.
23rd Oct 2016, 12:48 AM
Kirk Schafer
Kirk Schafer - avatar