What\'s a pythonic approach for reading a line from a file but not advancing where you are in the file?
For example, if you have a file of
cat1
cat2
You could use wrap the file up with itertools.tee and get back two iterators, bearing in mind the caveats stated in the documentation
For example
from itertools import tee
import contextlib
from StringIO import StringIO
s = '''\
cat1
cat2
cat3
'''
with contextlib.closing(StringIO(s)) as f:
handle1, handle2 = tee(f)
print next(handle1)
print next(handle2)
cat1
cat1