3 ms·
If with "file-like-object" you mean an object that requires previous opening and closing afterwards, take a look at the "with" statement. It is not really "tak
by flavio81 9y ago
If with "file-like-object" you mean an object that requires previous opening and closing afterwards, take a look at the "with" statement.
It is not really "taking advantage of Python OO design", but simply taking advantage of a statement that suits that usage.
This page gives good practical examples on how to take advantage of "with":
http://preshing.com/20110920/the-python-with-statement-by-example/ http://preshing.com/20110920/the-python-with-statement-by-ex...