Scott David Daniels wrote:

> Now if you want to do it for a file, you could do:
> 
>      for c in thefile.read():
>          ....

The whole point of the exercise is that seeking on a file doesn't
influence iteration over its content. In the loop you suggest, I can
seek() on thefile to my heart's content and will always get its content
iterated over exactly from beginning to end. It had been read before any
of this started, after all. Similarly, thefile.tell() will always tell me
thefile's size or the place I last seek()'ed to instead of the position of
the next char I will get.

-- 
Thomas

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to