title: Python: Why redefinition of a function is not an error? Is there a hackish way to have that feature?
body: <p>For example:</p>
  
  <pre><code>def foo():
      print 'first foo'
  def foo():
      print 'second foo'
  
  foo()
  </code></pre>
  
  <p>silently produces: <code>second foo</code></p>
  
  <p>Today I copy/pasted a function definition in the same file and changed a few lines in the body of second definition but forgot to change the function name itself. I scratched my head for a long time looking at the output and it took me a while to figure it out.</p>
  
  <p>How to force the interpreter throw at least a warning at redefinition of a function? Thanks in advance.</p>