Possible File iteration bug

Thomas Rachel nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915 at spamschutz.glglgl.de
Fri Jul 15 10:28:56 EDT 2011


Am 15.07.2011 14:52 schrieb Billy Mays:

> Also, in the python docs, file.next() mentions there
> being a performance gain for using the file generator (iterator?) over
> the readline function.

Here, the question is if this performance gain is really relevant AKA 
"feelable". The file object seems to have another internal buffer 
distinct from the one used for iterating used for the readline() 
function. Why this is not the same buffer is unclear to me.


> Really what would be useful is some sort of PauseIteration Exception
> which doesn't close the generator when raised, but indicates to the
> looping header that there is no more data for now.

a None or other sentinel value would do this as well (as ChrisA already 
said).


Thomas



More information about the Python-list mailing list