28 Jul
2010
28 Jul
'10
1:19 a.m.
Anders J. Munch wrote:
But suppose you could address the source instead? Suppose you could write yield_if_true in such a way that it did not become a generator despite yielding?
I don't see how this would work. The problem isn't that yield_if_true becomes a generator -- it's that the function calling yield_if_true *doesn't* become a generator, even though it needs to.
Let's call it 'yield_' , for lack of a better name. The function would yield the nearest generator on the call stack.
But if none of the calling functions have yields anywhere else, then they're just ordinary functions, and there is *no* generator on the call stack! -- Greg