title: Why can this unbound variable work in Python (pyquery)?
body: <p>The code is from the guide of pyquery</p>
  
  <pre><code>from pyquery import PyQuery
  d = PyQuery('&lt;p class="hello"&gt;Hi&lt;/p&gt;&lt;p&gt;Bye&lt;/p&gt;')
  d('p').filter(lambda i: PyQuery(this).text() == 'Hi')
  </code></pre>
  
  <p>My question is <code>this</code> in the 3rd line is an unbound variable and is never defined in current environment, but the above code still works.</p>
  
  <p>How can it work? Why it doesn't complain <code>NameError: name 'this' is not defined</code>?</p>
  
  <p>It seems that something happens at <a href="https://bitbucket.org/olauzanne/pyquery/src/c148e4445f49/pyquery/pyquery.py#cl-478" rel="noreferrer">https://bitbucket.org/olauzanne/pyquery/src/c148e4445f49/pyquery/pyquery.py#cl-478</a> , could anybody explain it?</p>