[Python-Dev] Coroutines and PEP 380

Glyph glyph at twistedmatrix.com
Wed Jan 18 12:27:39 CET 2012


On Jan 18, 2012, at 4:23 AM, Mark Shannon wrote:

> Glyph wrote:
>> On Jan 17, 2012, at 5:03 PM, Mark Shannon wrote:
>>> Lets start controversially: I don't like PEP 380, I think it's a kludge.
>> Too late; it's already accepted.  There's not much point in making controversial statements about it now.
> 
> Why is it too late?

Because discussion happens before the PEP is accepted.  See the description of the workflow in <http://www.python.org/dev/peps/pep-0001/>.  The time to object to PEP 380 was when those threads were going on.

> Presenting this as a fait accompli does not make it any better.

But it is[1] a fait accompli, whether you like it or not; I'm first and foremost informing you of the truth, not trying to make you feel better (or worse).  Secondly, I am trying to forestall a long and ultimately pointless conversation :).

> The PEP mailing list is closed to most people,

The PEP mailing list is just where you submit your PEPs, and where the PEP editors do their work.  I'm not on it, but to my understanding of the process, there's not really any debate there.

> so what forum for debate is there?

python-ideas, and then this mailing list, in that order.  Regarding PEP 380 specifically, there's been quite a bit.  See for example <http://thread.gmane.org/gmane.comp.python.devel/102161/focus=102164>.  Keep in mind that the purpose of debate in this context is to inform Guido's opinion.  There's no voting involved, although he will occasionally delegate decisions about particular PEPs to people knowledgeable in a relevant area.

>> I think this discussion would be more suitable for python-ideas though [...]
> Already been discussed:
> http://mail.python.org/pipermail/python-ideas/2011-October/012571.html

If you're following the PEP process, then the next step would be for you (having built some support) to author a new PEP, or to resurrect the deferred Stackless PEP with some new rationale - personally I'd recommend the latter.

My brief skimming of the linked thread doesn't indicate you have a lot of strong support though, just some people who would be somewhat interested.  So I still think it bears more discussion there, especially on the motivation / justification side of things.

> All of the objections to coroutines (as I propose) also apply to PEP 380.

You might want to see the video of Guido's "Fireside Chat" last year <http://pycon.tv/#/video/100>.  Skip to a little before 15:00.  He mentions the point that coroutines that can implicitly switch out from under you have the same non-deterministic property as threads: you don't know where you're going to need a lock or lock-like construct to update any variables, so you need to think about concurrency more deeply than if you could explicitly always see a 'yield'.  I have more than one "painful event in my past" (as he refers to it) indicating that microthreads have the same problem as real threads :).

(And yes, they're microthreads, even if you don't have an elaborate scheduling construct.  If you can switch to another stack by making a function call, then you are effectively context switching, and it can become arbitrarily complex.  Any coroutine in a system may introduce an arbitrarily complex microthread scheduler just by calling a function that yields to it.)

-glyph

([1]: Well actually it isn't, note the dashed line from "Accepted" to "Rejected" in the workflow diagram.  But you have to have a really darn good reason, and championing the rejection of a pep that Guido has explicitly accepted and has liked from pretty much the beginning is going to be very, very hard.)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20120118/2d8665a2/attachment.html>


More information about the Python-Dev mailing list