On Sat, Nov 25, 2017 at 4:57 PM, Nick Coghlan <ncogh...@gmail.com> wrote:
> On 26 November 2017 at 02:59, Guido van Rossum <gu...@python.org> wrote: > > > > I'd be happy to stop with the conclusion that we're going to rip out some > > confusing syntax rather than trying to generate code for it -- IMO we've > > proved to ourselves that this stuff is too complicated to be useful. > > I'll also note that even if we go through a period of deprecating and > then prohibiting the syntax entirely, we'll still have the option of > bringing support for "yield" in comprehensions back later with > deliberately designed semantics (as happened for "await" in > https://www.python.org/dev/peps/pep-0530/#await-in-comprehensions), as > opposed to the accident-of-implementation semantics they have now. > > It may also turn out that as more asynchronous code is able to switch > to being 3.6+ only, allowing "await" and prohibiting "yield" will > prove to be sufficient for all practical purposes (as even the "yield > from" based spelling is Python-3-only, so it's only code that still > has to support 3.3, 3.4, 3.5, without needing to support 2.7, that > could use "yield from + yield" comprehensions, but wouldn't have the > option of just switching to async+await instead). > And I'll also note that some style guides recommend using comprehensions only for simple cases. Example: https://google.github.io/styleguide/pyguide.html#List_Comprehensions -- expand by clicking on the arrow; the "Con" comment is "Complicated list comprehensions or generator expressions can be hard to read." -- --Guido van Rossum (python.org/~guido)
_______________________________________________ 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