On Wed, 22 Nov 2017 17:08:14 +0100 Ivan Levkivskyi <levkivs...@gmail.com> wrote: > On 22 November 2017 at 16:56, Yury Selivanov <yselivanov...@gmail.com> > wrote: > > > On Wed, Nov 22, 2017 at 10:10 AM, Ivan Levkivskyi <levkivs...@gmail.com> > > wrote: > > > On 22 November 2017 at 15:47, Paul Moore <p.f.mo...@gmail.com> wrote: > > [...] > > I'm all for prohibiting using 'yield' expression in generator > > expressions or comprehensions. The semantics is way to hard to > > understand and hence be of any value. > > > > Making 'await' a SyntaxError is absolutely not an option. Async > > generator expressions are a shorthand syntax for defining asynchronous > > generators (PEP 525), and it's already being used in the wild. > > > > OK, makes sense, so it looks like we may have the following plan: > > - fix `yield` in comprehensions > - update PEP 530 and docs re generator expressions vs comprehensions > - make `yield` in generator expressions a SyntaxError
Given a comprehension (e.g. list comprehension) is expected to work nominally as `constructor(generator expression)` (e.g. `list(generator expression)`), I think both generator expressions *and* comprehensions should raise a SyntaxError. (more exactly, they should first emit a SyntaxWarning and then raise a SyntaxError in a couple of versions) 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/archive%40mail-archive.com