On Mon, 02 Aug 2010 12:07:06 +1200 Greg Ewing firstname.lastname@example.org wrote:
There are still use cases for 'yield from', when you're dealing with generators that are designed to produce values.
It was the tree-walking example, right? It really looked like it solved a non-existing problem.
From an outsider's view (mine :-)), I think this alternative makes more sense than trying to stretch the generator protocol far beyond what it was designed for at the start. It would also clearly separate the two use cases of generative iteration and coroutines.
Well, that's one way of looking at it. Another is that generators and coroutines are such closely related concepts that it would seem odd not to be able to define one in terms of the other, or both in terms of some unifying construct.
Well, it sounds like saying classes and functions are closely related concepts because both denote callable objects. I think there is value in clearly distinguished concepts, rather than some intellectually appealing over-generalization (what Joel Spolsky calls Architecture Astronauts).