def for in yield or next for in

1
2
3
4
5
6
7
8
9
>>> a=['', 'a', 'a', '', 'a', '']
>>> b=['b', 'b', 'b']
>>> def f(s):
for x in s:
yield x
>>> [i or f(b).next() for i in a]
['b', 'a', 'a', 'b', 'a', 'b']
>>>