title: Why am I able to global a non-existing variable in python
body: <p>First, I fully understand what <code>global</code> statement means and how to use.</p>
  
  <p>Now, let's look at this:</p>
  
  <pre><code>x = 100
  def f():
      global x
      global xxx
      x = 99
      return x
  
  print(f())
  # &gt;&gt;&gt; 99
  print(x)
  # &gt;&gt;&gt; 99
  </code></pre>
  
  <p>You can see that by using <code>global x</code>, I successfully changed the value of x in the global environment.</p>
  
  <p>But <code>xxx</code> does not exist at all, why am I allowed to global it and it won't even bring any error even if the function is executed?</p>