Jim Jewett wrote:
On 4/1/09, Nick Coghlan <ncoghlan@gmail.com> wrote:
Greg Ewing wrote:
I've just thought of another possible alternative name for yield-from:
y = gcall f(x)
However, you would lose the common mnemonic with yield for both turning the current function into a generator and indicating to the reader that the current frame may get suspended at a particular point.
If the "gencall" exhausts the generator f (as "yield from" normally does), then the current frame shouldn't be suspended any more than it would be for an ordinary function call. If the "return value" of the generator really is important (and the intermediate values are discarded), then this probably is the right syntax. (Whether that case is worth syntax is a matter of taste, but it does seem to be a case Greg is trying to support.)
The intermediate values aren't necessarily discarded by "yield from" though: they're passed out to whoever is consuming the values yielded by the outermost generator. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia ---------------------------------------------------------------