title: Base class for open file objects?
body: <p>Suppose I want to add some custom behavior to a file object, such as returned by <code>open()</code>. According <a href="https://stackoverflow.com/a/23796737/699305">this answer</a>, there is (or was) no single base type for all file-like objects. Is this really still true? How about <code>io.IOBase</code>, or one of <em>its</em> subclasses, as suggested <a href="https://stackoverflow.com/a/24812058/699305">here</a>? Or perhaps by now there is an <a href="https://docs.python.org/3/library/abc.html" rel="nofollow noreferrer">abstract base class</a> that I could use? </p>
  
  <p>I have already looked at <a href="https://stackoverflow.com/questions/16085292/subclassing-file-objects-to-extend-open-and-close-operations-in-python-3">this question</a>, but (besides being quite old) the issues there are about customizing the <code>close()</code> method (best done with a context manager). So this does not answer my question (and please don't mark this question as a duplicate of it!). </p>