[Python-ideas] Batching/grouping function for itertools

Nick Coghlan ncoghlan at gmail.com
Sun Dec 8 22:56:45 CET 2013


On 9 Dec 2013 01:47, "Chris Angelico" <rosuav at gmail.com> wrote:
>
> On Mon, Dec 9, 2013 at 2:40 AM, Ron Adam <ron3200 at gmail.com> wrote:
> > The function would need to be a wrapper that keeps a buffer.  And the
front
> > of the buffer would always be the next to be yielded if there is
anything in
> > it.
>
> Which is what Stephen said in his pithy message above. Yes, it's
> theoretically possible, but it's not something to do in the general
> case. Not something to depend on for a chunker/grouper, which should
> be able to pass once over the underlying iterator.

tee() is this building block.

Cheers,
Nick.

>
> ChrisA
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20131209/a271e17d/attachment.html>


More information about the Python-ideas mailing list