On 23 November 2017 at 09:15, Greg Ewing <greg.ew...@canterbury.ac.nz> wrote:
> Ivan Levkivskyi wrote: > >> On 23 November 2017 at 05:44, Greg Ewing <greg.ew...@canterbury.ac.nz >> <mailto:greg.ew...@canterbury.ac.nz>> wrote: >> >> def g(): >> return ((yield i) for i in range(10)) >> >> >> I think this code should be just equivalent to this code >> >> def g(): >> temp = [(yield i) for i in range(10)] >> return (v for v in temp) >> > > But then you get a non-lazy iterable, which defeats the > purpose of using a generator expression -- you might as > well have used a comprehension to begin with. > > This could be just a semantic equivalence (mental model), not how it should be internally implemented. -- Ivan
_______________________________________________ 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