Bill Janssen wrote:

> Incidentally, what kind of iteration should apply to files opened in
> "binary" mode 

I don't think binary files should directly support
iteration at all. Wrap it in an object that iterates
the way you want.

   for b in readbytes(f):
     ...

   for blk in readblocks(f, 1024):
     ...

I'm inclined to think that text files shouldn't be
directly iterable either, and you should use

   for line in readlines(f):
     ...

I can appreciate that some people might consider
practicality to beat purity here, though.

 > How about 80-byte "records" :-?

No problem:

   for card in readblocks(f, 80):
     fortran_compiler.eat(card)

:-)

--
Greg
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to