title: Python idiom: List comprehension with limit of items
body: <p>I'm basically trying to do this (pseudo code, not valid python):</p>
  
  <pre><code>limit = 10
  results = [xml_to_dict(artist) for artist in xml.findall('artist') while limit--]
  </code></pre>
  
  <p>So how could I code this in a concise and efficient way?
  The XML file can contain anything between 0 and 50 artists, and I can't control how many to get at a time, and AFAIK, there's no XPATH expression to say something like "get me up to 10 nodes".</p>
  
  <p>Thanks!</p>