On Wed, Nov 26, 2014 at 11:46 AM, Ethan Furman ethan@stoneleaf.us wrote:
On 11/25/2014 04:37 PM, Chris Angelico wrote:
On Wed, Nov 26, 2014 at 10:46 AM, Ethan Furman ethan@stoneleaf.us wrote:
I don't see the difference being subtle enough -- if an odd number of items is tossed in, that `next(i)` is still going to raise a StopIteration, which under PEP 479 will become a RunTimeError.
Or did you mean that even numbered iterators will work fine, but odd-numbered ones will still raise? Nice. :)
Yes, I meant the silent termination of an iterable with an odd number of items. That's pretty subtle.
You mean an even number of items, yes?
Presumably the even case is the correct one. It's intended to work that way. If you give it an odd number of items, pre-479 they'll both silently terminate. (Post-479, the next(),next() one will always raise RuntimeError, which indicates clearly that it's not written appropriately, but that's not subtle.)
ChrisA