On Tue, Mar 31, 2015 at 12:52 AM, Andrew Barnert <abarnert@yahoo.com.dmarc.invalid> wrote:
If that is being done, anyway, I propose an optional parameter that would allow the context to internally use itertools.tee if the stream can't seek itself.
That sounds cool, but... If you have an actual file object with seek and tell, you're often using other methods besides iterating lines (like read), and tee won't help with those, so it might be a little misleading.
That shouldn't be an issue, though, as those will just use seek/tell. I'm more wondering about the ones that _do_ need the tee'ing; how, after the context manager completes, do you have the file object return something from the other half of the tee? I'm not sure this mode will work. If the stream can't use seek(), this context manager should simply let the exception bubble IMO. ChrisA