title: Why can you assign values to built-in functions in Python?
body: <p>I found out about this by accident today when I noticed that a piece of Python code had used the <a href="https://docs.python.org/2/library/functions.html">built-in function</a> <code>all</code> as a variable identifier to store the result of a list comprehension and it didn't throw an error, so I tried the following:</p>
  
  <pre><code>type('abc')
  Out[1]: str
  
  type('abc') == str
  Out[2]: True
  
  str = int
  
  type('abc') == str
  Out[4]: False
  
  type('abc')
  Out[5]: str
  
  type = [1,2,3]
  
  type('abc')
  ---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-7-a74a7df76db1&gt; in &lt;module&gt;()
  ----&gt; 1 type('abc')
  
  TypeError: 'list' object is not callable 
  </code></pre>
  
  <p>Hopefully, it's a valid question when I ask why this behavior is allowed in Python.</p>
  
  <p>Or better yet, how do I make sure that a built-in function like <code>str</code> is really <code>str</code> and not say, <code>int</code> so <code>str(123)</code> won't be evaluated as <code>int(123)</code> by accident?</p>