title: Iterate a format string over a list
body: <p>In Lisp, you can have something like this:</p>
  
  <pre><code>(setf my-stuff '(1 2 "Foo" 34 42 "Ni" 12 14 "Blue"))
  (format t "~{~d ~r ~s~%~}" my-stuff)
  </code></pre>
  
  <p>What would be the most Pythonic way to iterate over that same list? The first thing that comes to mind is:</p>
  
  <pre><code>mystuff = [1, 2, "Foo", 34, 42, "Ni", 12, 14, "Blue"]
  for x in xrange(0, len(mystuff)-1, 3):
      print "%d %d %s" % tuple(mystuff[x:x+3])
  </code></pre>
  
  <p>But that just feels awkward to me. I'm sure there's a better way?</p>
  
  <hr>
  
  <p>Well, unless someone later provides a better example, I think gnibbler's solution is the nicest\closest, though it may not be quite as apparent at first how it does what it does:</p>
  
  <pre><code>mystuff = [1, 2, "Foo", 34, 42, "Ni", 12, 14, "Blue"]
  for x in zip(*[iter(mystuff)]*3):
      print "{0} {1} {2}".format(*x)
  </code></pre>