title: About example code from google
body: <p>Why is this done</p>
  
  <pre><code>uri = urlparse(self.request.uri)
  if uri.query:
      query = parse_qs(uri.query)
      try:
          query = query['query'][0]
      except KeyError, err:
          query = ''
  </code></pre>
  
  <p>And not simply this</p>
  
  <p><code>query = self.request.get('query')</code></p>
  
  <p>? What will the difference be between to two code blocks?</p>
  
  <p>Source. <a href="https://code.google.com/p/google-app-engine-samples/source/browse/trunk/search/python/search_demo.py?r=157" rel="nofollow">https://code.google.com/p/google-app-engine-samples/source/browse/trunk/search/python/search_demo.py?r=157</a></p>