On Thu, 10 Mar 2016 08:22:58 +0000, Ola Fosheim Grøstad wrote:

> On Thursday, 10 March 2016 at 00:29:46 UTC, Jack Stouffer wrote:
>>> It's a pretty straight forward standard iterator design and quite
>>> different from the table pointers C++ uses.
>>
>> I explain my grievances in the article.
> 
> They didn't make all that much sense to me, so I wondered what Theo's
> issues were. As in: real issues that have empirical significance.

It's a little easier to write iterators in the Python style: you don't 
have to cache the current value, and you don't have to have a separate 
check for end-of-iteration. It's a little easier to use them in the D 
style: you get more flexibility, can check for emptiness without popping 
an item, and can grab the first item several times.

You can convert one to the other, so there's no theoretical difference in 
what you can accomplish with them. It's mainly annoying. A small 
efficiency concern, because throwing exceptions is a little slow.

The largest practical difference comes when multiple functions are 
interested in viewing the first item in the same range. LL(1) parsers 
need to do this.

Of course, that's just looking at input ranges versus iterators. If you 
look at other types of ranges, there's a lot there that Python is missing.

Reply via email to