On 2006-01-04, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
><[EMAIL PROTECTED]> wrote:
>> But here is my real question...
>> Why isn't something like this in itertools, or why shouldn't
>> it go into itertools?
>
>
>   4) If a need does arise, it can be met by __builtins__.map() or by
>      writing:  chain(iterable, repeat(None)).
>
> Yes, if youre a python guru.  I don't even understand the
> code presented in this thread that uses chain/repeat,

And it wouldn't work in this case. chain(iterable, repeat(None))
changes your iterable into an iterator that first gives you
all elements in the iterator and when these are exhausted
will continue giving the repeat parameter. e.g.

  chain([3,5,8],repeat("Bye")

Will produce  3, 5 and 8 followed by an endless stream
of "Bye".

But if you do this with all iterables, and you have to
because you don't know which one is the smaller, all
iterators will be infinite and izip will never stop.

-- 
Antoon Pardon
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to