B
Bengt Richter
ISTM the job of choosing an appropriate sentinel involves makingOp 2006-01-05 said:But you can fix that (only test is what you see ;-) :
Maybe, but not with this version.
...from itertools import repeat, chain, izip
it = iter(lambda z=izip(chain([3,5,8],repeat("Bye")), chain([11,22],repeat("Bye"))):z.next(), ("Bye","Bye"))
for t in it: print t
(3, 11)
(5, 22)
(8, 'Bye')
(Feel free to generalize ;-)
The problem with this version is that it will stop if for some reason
each iterable contains a 'Bye' at the same place. Now this may seem
far fetched at first. But consider that if data is collected from
that not only far fetched but well-nigh impossible ;-)
ISTM that confuses "missing data" with "end of data stream."experiments certain values may be missing. This can be indicated
by a special "Missing Data" value in an iterable. But this "Missing
Data" value would also be the prime canidate for a fill parameter
when an iterable is exhausted.
I assumed your choice of terminating sentinel ("Bye") would not have
that problem ;-)
Regards,
Bengt Richter