[Python-ideas] Cofunctions - Back to Basics

Matt Joiner anacrolix at gmail.com
Sun Oct 30 23:12:43 CET 2011


+10 for greenlet style coroutines. It's a very modern feature and will put
python in an excellent position. Also nick your points about asynchronous
io being the main use case are spot on as far as I'm concerned.
On Oct 31, 2011 8:49 AM, "Nick Coghlan" <ncoghlan at gmail.com> wrote:

> On Mon, Oct 31, 2011 at 7:16 AM, Greg Ewing <greg.ewing at canterbury.ac.nz>
> wrote:
> > Nick Coghlan wrote:
> >
> >> The fact that greenlets exists (and works) demonstrates that it is
> >> possible to correctly manage and execute multiple Python stacks within
> >> a single OS thread.
> >
> > I'm not convinced that greenlets work correctly under all
> > possible circumstances. As I understand, they work by copying
> > pieces of C stack in and out when switching tasks. That
> > fails if a pointer to local storage is kept anywhere that
> > can be reached by a different task. I seem to remember there
> > being an issue with Tk doing something like this and causing
> > problems for Stackless.
>
> Yeah, that sentence should have had a "mostly" inside the parentheses :)
>
> However, I think it may be more fruitful to pursue an approach that
> uses greenlets as the foundation, and works to close the loopholes
> (e.g. by figuring out a way for C code to mark itself as "coroutine
> safe" and assuming it is not safe by default) rather than trying to
> figure out how to make a "generators all the way down" approach handle
> invocation of arbitrary slots.
>
> Cheers,
> Nick.
>
> --
> Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20111031/fbbf935c/attachment.html>


More information about the Python-ideas mailing list