title: syntax error on nonlocal statement in Python
body: <p>I would like to test the example of the use of the nonlocal statement specified in the answer on <a href="https://stackoverflow.com/questions/1261875/python-nonlocal-statement">this</a> question:</p>
  
  <pre><code>def outer():
     x = 1
     def inner():
         nonlocal x
         x = 2
         print("inner:", x)
     inner()
     print("outer:", x)
  </code></pre>
  
  <p>but when I try to load this code, I always get a syntax error:</p>
  
  <pre><code>Traceback (most recent call last):
  
  
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "t.py", line 4
      nonlocal x
               ^
  SyntaxError: invalid syntax
  </code></pre>
  
  <p>Does anybody know what I am doing wrong here (I get the syntax error for every example that I use, containing <code>nonlocal</code>).</p>