Can you explain closures (as they relate to Python)?
<p>I've been reading a lot about closures and I think I understand them, but without clouding the picture for myself and others, I am hoping someone can explain closures as succinctly and clearly as possible.  I'm looking for a simple explanation that might help me understand where and why I would want to use them.</p>

<p><a href="http://mrevelle.blogspot.com/2006/10/closure-on-closures.html">Closure on closures</a></p>

<blockquote>
  <p>Objects are data with methods
  attached, closures are functions with
  data attached.</p>
</blockquote>

<pre><code>def make_counter():
    i = 0
    def counter(): # counter() is a closure
        nonlocal i
        i += 1
        return i
    return counter

c1 = make_counter()
c2 = make_counter()

print (c1(), c1(), c2(), c2())
# -&gt; 1 2 1 2
</code></pre>
