title: Create file wrapper that can be opened
body: <p>I need to handle a ZIP file with specialized content and thus want to create a wrapper, so that I can use something like</p>
  
  <pre><code>with open(MySpecialFile('/path/to/file.zip', 'rb')) as msf:
      &lt;snip&gt;
  </code></pre>
  
  <p>I already know how to implement the <code>__enter__</code> and <code>__exit__</code> methods, but I cannot find any documentation of how I can make the object be openable.
  I tried to implement an <code>__open__</code> function in the hope that python does apply the open() method in this way. Unfortunately this does not seem to be the case:</p>
  
  <pre><code>&gt;&gt;&gt; class Foo():
  ...     def __open__(self):
  ...         print('Opened!')
  ... 
  &gt;&gt;&gt; with open(Foo()) as f:
  ...     print('yay')
  ... 
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  TypeError: invalid file: &lt;__main__.Foo object at 0x7f93b630ab00&gt;
  </code></pre>
  
  <p>What is the right way to create a custom object that can be opened using <code>open()</code>?</p>