while c = f.read(1)

John Hunter jdhunter at ace.bsd.uchicago.edu
Tue Aug 23 03:29:51 CEST 2005

>>>>> "Robert" == Robert Kern <rkern at ucsd.edu> writes:

    Robert> Greg McIntyre wrote:
    >> The 2nd option has real potential for me. Although the total
    >> amount of code is greater, it factors out some complexity away
    >> from the actual job, so that code is not obscured by
    >> unnecessary compexity. IMHO that's great practice.

    Robert> Please quote the message you are replying to. We have no
    Robert> idea what "the 2nd option" is.

I think he means the second option you presented

  If you must read one character at a time,

     def reader(fileobj, blocksize=1):
         """Return an iterator that reads blocks of a given size from a
         file object until EOF.

With a decent threaded news/mail reader, the thread provides
sufficient context, no?


More information about the Python-list mailing list