xrange

Bryan belred1 at yahoo.com
Sun Jun 22 21:08:08 EDT 2003


> itertools.repeat(obj, n) was not intended to be "second or third way to
> do it".  It was included in the module to meet a very specific need for
> supplying repeated arguments to imap() and ifilter():
>
>    cubeiter = imap(operator.pow, count(), repeat(3))
>
>  Right now, it meets an important
> need for an iteration counter that doesn't eat memory for breakfast.  For
> Py3.0, range() will probably return a fast, memory efficient iterator.
>
>
> Raymond Hettinger
>
>

thanks raymond... this is exactly what i was after.  i place and purpose for
repeat (and count).  now i see exactly when, where and how i'll be using it.
i've read several postings and articles on iterators and itertools, but what
you said just made it all "click".

bryan






More information about the Python-list mailing list