
Question about the performance of Python - anitabenites
which kind(examples) of file-like objects could take an advantage of Python&#x27;s object oriented design?
======
flavio81
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-
ex...](http://preshing.com/20110920/the-python-with-statement-by-example/)

