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 -- http://mail.python.org/mailman/listinfo/python-list