Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
itertools.izip brokeness
- From: bokr at oz.net (Bengt Richter)
- Subject: itertools.izip brokeness
- Date: Tue, 10 Jan 2006 02:18:27 GMT
On 9 Jan 2006 08:19:21 GMT, Antoon Pardon <apardon at forel.vub.ac.be> wrote:
>Op 2006-01-05, Bengt Richter schreef <bokr at oz.net>:
>> On 5 Jan 2006 15:48:26 GMT, Antoon Pardon <apardon at forel.vub.ac.be> 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
- Follow-Ups:
- itertools.izip brokeness
- From: Antoon Pardon
- itertools.izip brokeness
- References:
- itertools.izip brokeness
- From: rurpy at yahoo.com
- itertools.izip brokeness
- From: Peter Otten
- itertools.izip brokeness
- From: Duncan Booth
- itertools.izip brokeness
- From: rurpy at yahoo.com
- itertools.izip brokeness
- From: rurpy at yahoo.com
- itertools.izip brokeness
- From: Antoon Pardon
- itertools.izip brokeness
- From: Bengt Richter
- itertools.izip brokeness
- From: Antoon Pardon
- itertools.izip brokeness
- Prev by Date: Is 'everything' a refrence or isn't it?
- Next by Date: another docs problem - imp
- Previous by thread: itertools.izip brokeness
- Next by thread: itertools.izip brokeness
- Index(es):