a...@pythoncraft.com (Aahz) writes: > In article <mailman.2639.1246802753.8015.python-l...@python.org>, > Hendrik van Rooyen <m...@microcorp.co.za> 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