[Python-Dev] Simple coroutines?

Moore, Paul Paul.Moore at atosorigin.com
Tue Aug 24 15:58:42 CEST 2004


From: Greg Ewing
> There will be a new statement:
>
>     suspend
>
[...]
>
>    do another_coop()
>
> would be equivalent to
>
>    co = another_coop()
>    while co.run():
>        suspend


I'm not sure I see the difference between suspend/do and
yield True/for _ in co: pass, other than possibly that
co-operators and generators are intended to be mixed (which
strikes me as implausible).

I'm likely to be missing something here, but I don't follow
the semantics you are suggesting.

If there was a simple, realistic use case for this, it might
help clarify the semantics. (For extra credit, mix co-operators
and generators in your use case so that the semantics of
interaction are shown as well :-))

Paul.


__________________________________________________________________________
This e-mail and the documents attached are confidential and intended 
solely for the addressee; it may also be privileged. If you receive this 
e-mail in error, please notify the sender immediately and destroy it.
As its integrity cannot be secured on the Internet, the Atos Origin group 
liability cannot be triggered for the message content. Although the 
sender endeavours to maintain a computer virus-free network, the sender 
does not warrant that this transmission is virus-free and will not be 
liable for any damages resulting from any virus transmitted.
__________________________________________________________________________


More information about the Python-Dev mailing list