<div dir="ltr"><div>For those interested in tracking the history of generators and coroutines in Python, I just found out that <a href="https://www.python.org/dev/peps/pep-0342/">PEP 342</a> (which introduced send/throw/close and made "generators as coroutines" a mainstream Python concept) harks back to <a href="https://www.python.org/dev/peps/pep-0288/">PEP 288</a>, which was rejected. PEP 288 also proposed some changes to generators. The interesting bit though is in the references: there are two links to old articles by David Mertz that describe using generators in state machines and other interesting and unconventional applications of generators. All these well predated PEP 342, so yield was a statement and could not receive a value from the function calling next() -- communication was through a shared class instance.<br><br><a href="http://gnosis.cx/publish/programming/charming_python_b5.txt">http://gnosis.cx/publish/programming/charming_python_b5.txt</a><br><a href="http://gnosis.cx/publish/programming/charming_python_b7.txt">http://gnosis.cx/publish/programming/charming_python_b7.txt</a><br><br></div>Enjoy!<br clear="all"><div><div><br>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div></div></div>