[email protected] (Aahz) writes: > In article <[email protected]>, > Hendrik van Rooyen <[email protected]> wrote: >> >>But wait - maybe if he passes an iterator around - the equivalent of >>for char in input_stream... Still no good though, unless the next call >>to the iterator is faster than an ordinary python call. > > Calls to iterators created by generators are indeed faster than an > ordinary Python call, because the stack frame is already mostly set up.
I think Beazely demonstrated this in his talk on using the python 2.5 co-routines to setup an xml parser. I believe he benchmarked it roughly and the initial results were rather impressive. http://www.dabeaz.com/coroutines/ -- http://mail.python.org/mailman/listinfo/python-list
