Catch-all proposal based on proxies

Mike Samuel mikesamuel at gmail.com
Thu Dec 10 20:37:47 PST 2009


2009/12/10 David-Sarah Hopwood <david-sarah at jacaranda.org>:
> Mike Samuel wrote:
>> Proxy based iterators work well with existing loop constructs though
>>     while ('next' in iterator) doSomething(iterator.next);
>
> I don't understand what advantage this has over
>      while (iterator.hasNext()) doSomething(iterator.next());

Sure.  If there were a hasNext() method, that would work.
Python does not have such a thing.

> If next() has side-effects (moving to the next element), it shouldn't
> be a getter.

Fair enough.

> --
> David-Sarah Hopwood  ⚥  http://davidsarah.livejournal.com
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>


More information about the es-discuss mailing list