How do you explain closures?
algorias: Closures are the context in which a function executes. The best way to demonstrate this is with a silly example that sticks in the mind:  def learn_how_to_greet(formal=True):
    if formal:
      string = "Good day, Mr. {last_name}."
    else:
      string = "What's up, {first_name}?"
    def greet(**kwds):
      return string.format(**kwds)
    return greet