title: Python eval() builtin function
body: <p>After looking for some reference online I still do not understand how eval() really works, maybe I am missing a key component, hopefully someone can guide me to the right docs or explanation.</p>
  
  <p>Suppose:</p>
  
  <pre><code>def foo(x,y):
      print(x)
      print(y)
  </code></pre>
  
  <p>Use eval() to call foo().</p>
  
  <p>Example 1:</p>
  
  <pre><code>eval('foo(1,2)') 
  </code></pre>
  
  <p>Example 2:</p>
  
  <pre><code>eval('foo')(1,2)
  </code></pre>
  
  <p>According to python 3.6 documentation, the way I am calling eval() on example is how it should be done, as I am passing everything as a string, However, for example #2 I still do not understand why python interpreter also evaluates correctly.To me when running eval() on the second example the python interpreter should return a TypeError requiring 2 missing arguments. I am hoping if someone can point me in the right direction.</p>