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? Presenting this as a fait accompli does not make it any better. The PEP mailing list is closed to most people, so what forum for debate is there?


I think that CPython should have proper coroutines, rather than add more bits and pieces to generators in an attempt to make them more like coroutines.

By "proper" coroutines, you mean implicit coroutines (cooperative threads) rather than explicit coroutines (cooperative generators).
Nothing "implicit" about it.
Python has been going in the "explicit" direction on this question for a long time. (And, in my opinion, this is the right direction to go, but that's not really relevant here.)

You can use asymmetric coroutines with a scheduler to provide cooperative threads if you want, but coroutines not have to be used as threads.

The key advantages of my coroutine implmentation over PEP 380 are:

1. No syntax change.
2. Code can be used in coroutines without modification.
3. No stack unwinding is required at a yield point.


I think this discussion would be more suitable for python-ideas though, since you have a long row to hoe here. There's already a PEP - http://www.python.org/dev/peps/pep-0219/ - apparently deferred and not rejected, which you may want to revisit.

There are several libraries which can give you cooperative threading already; I assume you're already aware of greenlet and stackless, but I didn't see what advantages your proposed implementation provides over those. I would guess that one of the first things you should address on python-ideas is why adopting your implementation would be a better idea than just bundling one of those with the standard library :).

Already been discussed:
http://mail.python.org/pipermail/python-ideas/2011-October/012571.html

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

The advantage of my implementation over greenlets is portability.

I suspect stackless is actually fairly similar to what I have done,
I haven't checked in detail.

Cheers,
Mark.

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to