On 10/03/2016 18:33, Neal Becker wrote:
Is there a way to ensure resource cleanup with a construct such as:

x = load (open ('my file', 'rb))

Is there a way to ensure this file gets closed?


I don't see how there can be. Surely you must split it into two lines to use the context manager via the 'with' keyword, or you leave the one line as is and forego the context manager.

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to