title: What do double parentheses mean in a function call? e.g. func(foo)(bar)
body: <p>I use this idiom all the time to print a bunch of content to standard out in utf-8 in Python 2:</p>
  <pre><code>sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
  </code></pre>
  <p>But to be honest, I have no idea what the <code>(sys.stdout)</code> is doing. It sort of reminds me of a Javascript closure or something. But I don't know how to look up this idiom in the Python docs.</p>
  <p>Can any of you fine folks explain what's going on here? Thanks!</p>