title: In python, how do I map an iterable to an iterable?
body: <p>I have an iterable -- that is, something which responds to <code>__iter__</code> and which can be  iterated over lazily, <em>multiple times</em> using a new fresh iterator each time.</p>
  
  <p>I want to <em>map</em> this to another <em>iterable</em>, which can also be iterated over multiple times, but without bringing the whole collection into memory.</p>
  
  <p><code>map</code> doesn't work -- it returns a list, so brings the whole dataset into memory.</p>
  
  <p><code>itertools.imap</code> also doesn't work -- it takes an <em>iterable</em> but returns a one-shot <em>iterator</em>.</p>
  
  <p>What I'm looking for is a set of itertools-like combinators which operate at the level of iterables. Only at the final stage, when I'm consuming the end result, do I want a single-shot iterator object, so I don't really understand why <code>itertools</code> returns them rather than returning e.g. some kind of MappedIterable.</p>
  
  <p>Pointers anyone? Or is this somehow heretically non-Pythonic?</p>