On 22 Nov 2014 02:51, "Antoine Pitrou" <solip...@pitrou.net> wrote:
>
> On Fri, 21 Nov 2014 05:47:58 -0800
> Raymond Hettinger <raymond.hettin...@gmail.com> wrote:
> >
> > Another issue is that it breaks the way I and others have taught for
years that generators are a kind of iterator (an object implementing the
iterator protocol) and that a primary motivation for generators is to
provide a simpler and more direct way of creating iterators.  However,
Chris explained that, "This proposal causes a separation of generators and
iterators, so it's no longer possible to pretend that they're the same
thing."  That is a major and worrisome conceptual shift.
>
> I agree with Raymond on this point.

A particularly relevant variant of the idiom is the approach of writing
"__iter__" directly as a generator, rather than creating a separate custom
iterator class. In that context, the similarities between the __iter__
implementation and the corresponding explicit __next__ implementation is a
beneficial feature.

I'm definitely coming around to the point of view that, even if we wouldn't
design it the way it currently works given a blank slate, the alternative
design doesn't provide sufficient benefit to justify the cost of changing
the behaviour & getting people to retrain their brains.

Cheers,
Nick.

>
> Regards
>
> Antoine.
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to