[Python-ideas] [Python-Dev] yield * (Re: Missing operator.call)

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Feb 9 00:19:15 CET 2009


Leif Walsh wrote:

> I still don't understand why such a construct is necessary.  Is
> 
>>>>for elt in iterable:
>>>>    yield elt
> 
> really all that bad?

If all you want is to pass yielded values outwards, it's
not all that bad, although it could get a bit tedious
if you're doing it a lot.

However, if you want values passed back in by send() to
go to the right places, it's *considerably* more
complicated.

The expansion I posted just before shows, I think, that
this is not something you want to have to write out
longhand every time -- at least not if you want a good
chance of getting it right!

-- 
Greg



More information about the Python-ideas mailing list