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

Paul Moore p.f.moore at gmail.com
Tue Jan 6 19:47:46 CET 2015


On 6 January 2015 at 18:43, Ethan Furman <ethan at stoneleaf.us> wrote:
> Yup, it sure does.  Guess I should have paid more attention to that niggling feeling that I was missing something.  ;)
> On the other hand, I figured even if I was wrong it wouldn't hurt to increase awareness about the change to generators.

I should probably point out that when writing my code, I was conscious
of the generator change and took special case of catching all of the
StopIterations that might leak out. It's probably good that I was made
to think carefully about it, but all those try...except blocks sure
look ugly. (And Steven's version with its sentinel value doesn't look
much better, with all those comparisons against a magic value - it's
just a generally annoying algorithm with all the code paths for corner
cases).

Paul


More information about the Python-ideas mailing list