3 ms·
A major motivation for the new syntax is to support refactoring (currently moving "yield" into a sub-function makes the calling function no longer a generator).
by drothlis 11y ago
A major motivation for the new syntax is to support refactoring (currently moving "yield" into a sub-function makes the calling function no longer a generator).
See the PEP's "rationale and goals"[1] and this article[2] summarising the PEP.
[1] https://www.python.org/dev/peps/pep-0492/#rationale-and-goals https://www.python.org/dev/peps/pep-0492/#rationale-and-goal...
[2] https://lwn.net/Articles/643786/ https://lwn.net/Articles/643786/