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

Ethan Furman ethan at stoneleaf.us
Tue Jan 6 20:02:16 CET 2015


On 01/06/2015 10:47 AM, Paul Moore wrote:
> On 6 January 2015 at 18:43, Ethan Furman 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.

Having looked more closely at your code, I don't see any thing that wouldn't have had to be there even without the
generator change because your exhausting two iterators.

> (And Steven's version with its sentinel value doesn't look
> much better, with all those comparisons against a magic value

I think I prefer his, although I would rename MISSING to FINISHED.  ;)

--
~Ethan~

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150106/9462187d/attachment.sig>


More information about the Python-ideas mailing list