> For reading bytes, I *know* that a lot of code would become uglier if
> the API changed to raise EOFError exceptions


I had StopIteration in mind.  Instead of writing:

    while 1:
        block = f.read(20)
        if line == '':
            break
        . . .

We would use:

    for block in f.readblocks(20):
        . . .


More beauty, a little faster, more concise, and less error-prone.  Of
course, there are likely better choices for the method name, but you get
the gist of it.

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to