On Tue, 2008-09-16 at 13:06 +1200, Greg Ewing wrote:
Cliff Wells wrote:
s = 'abc' x = for c in s: YIELD c # x = 'a', 'b', 'c'
You mean that the value of (for c in s: YIELD c) is a tuple? Or that it's an iterator that produces that series of values?
I = [ 'spam', 'eggs' ]
for J in I: # J = 'spam' then 'eggs' YIELD ( # evaluate to an iterable for j in J: YIELD j # j is 's' then 'p' then ... )
so we get '-'.join( 's','p','a','m','e','g','g','s' )
I'm still not getting a clear idea of what semantics you intend for a for-loop-with-YIELD. Neither of the interpretations I suggested above (sequence or iterator) seems to produce this result.
Actually, I think I see the issue. join() is getting a list of iterators (using list notation for simplicity):
'-'.join ( [ [ 's','p','a','m'], ['e','g','g','s'] ] )
(I promise you I'm not being intentionally obtuse).
Is this the conclusion you were coming to or something else?