Andrew Dalke <[EMAIL PROTECTED]> writes: > On Mon, 28 Feb 2005 18:25:51 -0500, Douglas Alan wrote:
>> While writing a generator, I was just thinking how Python needs a >> "yield_all" statement. With the help of Google, I found a >> pre-existing discussion on this from a while back in the >> Lightweight Languages mailing list. I'll repost it here in order >> to improve the chances of this enhancement actually happening >> someday. > You should also have looked for the responses to that. Tim Peter's > response is available from > http://aspn.activestate.com/ASPN/Mail/Message/624273 [...] > Here is the most relevant parts. [...] > BTW, Python almost never worries about worst-case behavior, and people > using Python dicts instead of, e.g., balanced trees, get to carry their > shame home with them hours earlier each day <wink> . If you'll reread what I wrote, you'll see that I'm not concerned with performance, but rather my concern is that I want the syntactic sugar. I'm tired of writing code that looks like def foogen(arg1): def foogen1(arg2): # Some code here # Some code here for e in foogen1(arg3): yield e # Some code here for e in foogen1(arg4): yield e # Some code here for e in foogen1(arg5): yield e # Some code here for e in foogen1(arg6): yield e when it would be much prettier and easier to read if it looked like: def foogen(arg1): def foogen1(arg2): # Some code here # Some code here yield_all foogen1(arg3) # Some code here yield_all foogen1(arg4) # Some code here yield_all foogen1(arg5) # Some code here yield_all foogen1(arg6) |>oug -- http://mail.python.org/mailman/listinfo/python-list