title: What is the python "with" statement designed for?
body: <p>I came across the Python <code>with</code> statement for the first time today.  I've been using Python lightly for several months and didn't even know of its existence!  Given its somewhat obscure status, I thought it would be worth asking:</p>
  
  <ol>
  <li>What is the Python <code>with</code> statement
  designed to be used for?   </li>
  <li>What do
  you use it for? </li>
  <li>Are there any
  gotchas I need to be aware of, or
  common anti-patterns associated with
  its use?  Any cases where it is better use <code>try..finally</code> than <code>with</code>?</li>
  <li>Why isn't it used more widely?</li>
  <li>Which standard library classes are compatible with it?</li>
  </ol>