title: Why can you use eval() with the function repr(y) inside and not str(y)?
body: <p>Here is some code that I've found and would like for someone to explain.</p>
  
  <p>If I assign a string to the variable y, evaluate it with the eval function and assign the content to the variable y2, the interpreter returns true.</p>
  
  <pre><code>&gt;&gt;&gt; y = 'a string'
  &gt;&gt;&gt; y2 = eval(repr(y))
  &gt;&gt;&gt; y == y2
  &gt;&gt;&gt; True
  </code></pre>
  
  <p>Where as using str(y) in this fashion:</p>
  
  <pre><code>&gt;&gt;&gt; eval(str(y))
  Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "&lt;string&gt;", line 1
  a string
         ^
  SyntaxError: unexpected EOF while parsing
  </code></pre>
  
  <p>is not allowed. Why is that?</p>