On 22 November 2017 at 16:30, Ivan Levkivskyi <levkivs...@gmail.com> wrote: > On 22 November 2017 at 17:24, Antoine Pitrou <solip...@pitrou.net> wrote: >> Given a comprehension (e.g. list comprehension) is expected to work >> nominally as `constructor(generator expression)` > > As Yury just explained, these two are not equivalent if there is an `await` > in the comprehension/generator expression.
As Antoine said, people *expect* them to work the same. If they don't, then that's a subtle change that came in as a result of the new async functionality. It's a shame that this wasn't made clearer at the time - one of the major issues I see with async is that it works "nearly, but not quite" the way people expect, and we need to do more to help people integrate async into their intuition. Just reiterating "that's not right" isn't much help - we need to educate people in better intuitions if the traditional ones are no longer accurate. At the moment, I know I tend to treat Python semantics as I always did, but with an implicit proviso, "unless async is involved, when I can't assume any of my intuitions apply". That's *not* a good situation to be in. Paul _______________________________________________ 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