[Python-Dev] Single- vs. Multi-pass iterability

Aahz aahz@pythoncraft.com
Mon, 15 Jul 2002 19:06:19 -0400


On Tue, Jul 16, 2002, Greg Ewing wrote:
> Guido:
>> Greg:
>>>
>>> If the file object were to become an object obeying the iterator
>>> protocol, its next() method should really return the next *byte* of
>>> the file.
>>
>> I don't think so.  We should pick the most convenient chunking for the
>> default iterator
> 
> But we're talking here about making the file object *be* an iterator
> itself, not just have a "default iterator". If that's to happen, all
> the other ways of iterating over a file ought to be implemented on top
> of the basic iteration facility provided by the file object -- lest we
> get unfortunate interactions between the different iteration methods a
> la xreadlines(). To me, this implies that the file object must iterate
> by bytes.

"Practicality beats purity"
-- 
Aahz (aahz@pythoncraft.com)           <*>         http://www.pythoncraft.com/

Project Vote Smart: http://www.vote-smart.org/