title: Function acting as both decorator and context manager in Python?
body: <p>This might be pushing things a little too far, but mostly out of curiosity..</p>
  
  <p>Would it be possible to have a callable object (function/class) that acts as <em>both</em> a Context Manager and a decorator at the same time:</p>
  
  <pre><code>def xxx(*args, **kw):
      # or as a class
  
  @xxx(foo, bar)
  def im_decorated(a, b):
      print('do the stuff')
  
  with xxx(foo, bar):
      print('do the stuff')
  </code></pre>