[Python-ideas] Cofunctions - A New Protocol

Nick Coghlan ncoghlan at gmail.com
Thu Nov 3 03:31:34 CET 2011


On Thu, Nov 3, 2011 at 11:51 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>>>> def f():
> ...     print("Started")
> ...     data = cothread.suspend(1)
> ...     print("Resumed:", data)
> ...     return 42
> ...
>>>> cf, data = cothread.cocall(f)
> Started


An easier-to-read copy of the cothread module that was attached to my
previous email:
https://bitbucket.org/ncoghlan/misc/src/default/cothread.py

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list