[Python-ideas] Possible new itertool: comm()

Devin Jeanpierre jeanpierreda at gmail.com
Wed Jan 7 22:04:28 CET 2015

On Wed, Jan 7, 2015 at 12:24 PM, Eric V. Smith <eric at trueblade.com> wrote:
> On 01/07/2015 01:20 PM, David Mertz wrote:
>> However, the problem with the functionality is that it assumes that the
>> iterables given to it return pre-sorted values.  Which is fine it that
>> assumption is satisfied, but one really can't know in advance of
>> exhausting the iterators whether that will prove true.  The desired
>> behavior in the absence of this pre-condition being satisfied is unclear
>> to me.
> itertools.groupby has the same requirement for a pre-sorted input iterator.

groupby doesn't require sorted input, and behaves in an obvious way
for jumbled input. But you're right, of all the functions, it's the
most like comm() in terms of the kind of requirements placed on input.

-- Devin

More information about the Python-ideas mailing list