[Python-Dev] PEP 550 v4 (original) (raw)

Ivan Levkivskyi levkivskyi at gmail.com
Wed Sep 6 08:58:18 EDT 2017


On 6 September 2017 at 11:13, Nathaniel Smith <njs at pobox.com> wrote:

On Wed, Sep 6, 2017 at 1:49 AM, Ivan Levkivskyi <levkivskyi at gmail.com> wrote: > Normal generators fall out from this "scheme", and it looks like their > behavior is determined by the fact that coroutines are implemented as > generators. What I think miht help is to add few more motivational examples > to the design section of the PEP.

Literally the first motivating example at the beginning of the PEP ('def fractions ...') involves only generators, not coroutines.

And this is probably what confuses people. As I understand, the tasks/coroutines are among the primary motivations for the PEP, but they appear somewhere later. There are four potential ways to see the PEP:

  1. Generators are broken*, and therefore coroutines are broken, we want to fix the latter therefore we fix the former.
  2. Coroutines are broken, we want to fix them and let's also fix generators while we are at it.
  3. Generators are broken, we want to fix them and let's also fix coroutines while we are at it.
  4. Generators and coroutines are broken in similar ways, let us fix them as consistently as we can.

As I understand the PEP is based on option (4), please correct me if I am wrong. Therefore maybe this should be said more straight, and maybe then we should show in addition a task example in rationale, show how it is broken, and explain that they are broken in slightly different ways (since expected semantics is a bit different).

-- Ivan



More information about the Python-Dev mailing list