On 9 Jan 2006 08:19:21 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: >Op 2006-01-05, Bengt Richter schreef <[EMAIL PROTECTED]>: >> On 5 Jan 2006 15:48:26 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: [...] >> 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 ISTM the job of choosing an appropriate sentinel involves making that not only far fetched but well-nigh impossible ;-)
>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. > ISTM that confuses "missing data" with "end of data stream." I assumed your choice of terminating sentinel ("Bye") would not have that problem ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list