title: Better illustration of Closures?
body: <p>I am learning Python using <a href="https://diveintopython3.net" rel="nofollow noreferrer">Dive Into Python 3</a> book. I like it, but I don't understand the <a href="https://diveintopython3.net/generators.html#a-file-of-patterns" rel="nofollow noreferrer">example used to introduce Closures</a> in Section 6.5.</p>
  
  <p>I mean, I see how it works, and I think it's really cool. But I don't see any real benefit:  it seems to me the same result could be achieved by simply reading in the rules file line by line in a loop, and doing search / replace for each line read.</p>
  
  <p>Could someone help me to:</p>
  
  <ul>
  <li><p>either understand why using closures in this example improves the code (e.g., easier to maintain, extend, reuse, or debug?)</p></li>
  <li><p>or suggest a source of some other real-life code examples where closures really shine?</p></li>
  </ul>