title: How exactly Deferred functions are useful in Go and what alternative is available in other languages?
body: <p>I know it's to deferred a process. I also read examples like it's good to use when dealing with File and other resources. My question is, is it something not being handled in other languages like Python etc? If yes how Go provides some distinctive feature?</p>
  
  <p>Say there are two functions <code>f1</code> and <code>f2</code> and I want to call <code>f2</code> when <code>f1</code> is done. I can do something like:</p>
  
  <pre class="lang-py prettyprint-override"><code>def f1():
    done = False
    print('I am doing extensive work')
    done = True
    return done
  
  def f2():
    print('here we go')
  
  if f1():
    f2()
  </code></pre>
  
  <p>Is defer doing same thing by minimizing coding efforts?</p>