David Mertz wrote:
Just make grouping() a generator function rather than a plain function. This lets us get an incremental grouping of an iterable. This can be useful if the iterable is slow or infinite, but the partial groupings are useful in themselves.

Do you have any real-world examples? I'm having trouble
thinking of any.

Even if there are a few, it seems like the vast majority of
the time you *won't* want the intermediate groupings, just
the final one, and then what do you do? It would be annoying
to have to write code to exhaust the iterator just to get the
result you're after.

Also, were you intending it to return a series of independent
objects, or does it just return the same object every time,
adding stuff to it? The former would be very inefficient for
the majority of uses, whereas the latter doesn't seem to
be in keeping with the spirit of itertools.

This idea seems like purity beating practicality to me.

--
Greg
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to