On Mar 12, 2013 6:56 AM, "Jason Orendorff" <[email protected]> wrote: > > On Mon, Mar 11, 2013 at 2:48 PM, Kevin Gadd <[email protected]> wrote: >> >> Another option for scenarios like open() where it is not cheap to >> create multiple distinct iterators (each starting from the beginning), >> or for scenarios where it's impossible (like a network stream) would >> be to only expose an iterator in those instances, not an iterable. > > > But then how would you use it? > > If you could not use a for-of loop on it, or pass it to functions like zip(), that is throwing the baby out with the bathwater. >
At a risk of repeating myself, 'open()' scenario is handled perfectly well with the iterable (see my example). Example where things truly cannot be reiterated (I am not sure why network stream is such an example - the network connection can always be opened twice) are rare. One possibility will be to throw on the second call to iterator(). > -j > > > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

