On 22 November 2017 at 16:08, Ivan Levkivskyi <[email protected]> wrote: > On 22 November 2017 at 16:56, Yury Selivanov <[email protected]> > wrote: >> >> On Wed, Nov 22, 2017 at 10:10 AM, Ivan Levkivskyi <[email protected]> >> wrote: >> > On 22 November 2017 at 15:47, Paul Moore <[email protected]> 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
I'm still not clear what "fix" would actually mean, but you propose clarifying the docs below, so I assume it means "according to whatever the updated docs say"... > - update PEP 530 and docs re generator expressions vs comprehensions Docs more importantly than PEP IMO. And are you implying that there's a difference between generator expressions and comprehensions? I thought both were intended to behave as if expanded to a function containing nested for loops? Nothing said in this thread so far (about semantics, as opposed to about current behaviour) implies there's a deliberate difference. > - make `yield` in generator expressions a SyntaxError That contradicts the suggestion that generator expressions are equivalent to the expanded function definition we saw before. > If everyone agrees, then I propose to open a separate issue on b.p.o. to > coordinate the efforts. I agree it needs clarifying. Not sure I agree with your proposed semantics, but I guess that can wait for when we have a concrete doc change proposal. Paul _______________________________________________ Python-Dev mailing list [email protected] https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
