title: Get first N items of list, ok if list is shorter
body: <p>Print first N items of a list/generator</p>
  
  <p>This works for plain lists. It prints the first 3 items of the list</p>
  
  <pre><code>l=[1, 2, 3, 4]
  print(l[:min(3, len(l))])
  </code></pre>
  
  <p>I want this work for lists with less then three items, too. If there is only one item in the list, then print one item.</p>
  
  <p>AFAIK len(l) only works for lists. How to implement this for generators?</p>