title: How does sympy work? How does it interact with the interactive Python shell, and how does the interactive Python shell work?
body: <p>What happens internally when I press <kbd>Enter</kbd>?</p>
  
  <p>My motivation for asking, besides plain curiosity, is to figure out what happens when you</p>
  
  <pre><code>from sympy import *
  </code></pre>
  
  <p>and enter an expression. How does it go from <kbd>Enter</kbd> to calling</p>
  
  <pre><code>__sympifyit_wrapper(a,b)
  </code></pre>
  
  <p>in sympy.core.decorators? (That's the first place <a href="http://winpdb.org" rel="noreferrer">winpdb</a> took me when I tried inspecting an evaluation.) I would guess that there is some built-in eval function that gets called normally, and is overridden when you import sympy?</p>