while c = f.read(1)

John Hunter jdhunter at ace.bsd.uchicago.edu
Mon Aug 22 21:29:51 EDT 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.
         ...snip

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

JDH



More information about the Python-list mailing list