On Sun, 2003-03-23 at 17:55, Jim Weirich wrote: > This problem is was easy to convert because the basic loop is easy to > unroll. If the algorithm were more deeply nested, or used yield in > multiple locations, the conversion would be more obscure. For example, > a generator that returned the leaves of a tree data structure would be > fairly easy using generators, but more difficult without. Now I'm responding to my own messages, which is dangerously close to talking to myself. But another, more common, problem where generators have the advantage is trying to iterate over two lists in parallel. -- -- Jim Weirich jweirich / one.net http://w3.one.net/~jweirich --------------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)