[Python-Dev] Ancient use of generators (original) (raw)

Guido van Rossum guido at python.org
Wed May 6 17:57:56 CEST 2015


For those interested in tracking the history of generators and coroutines in Python, I just found out that PEP 342 <https://www.python.org/dev/peps/pep-0342/> (which introduced send/throw/close and made "generators as coroutines" a mainstream Python concept) harks back to PEP 288 <https://www.python.org/dev/peps/pep-0288/>, 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.

http://gnosis.cx/publish/programming/charming_python_b5.txt http://gnosis.cx/publish/programming/charming_python_b7.txt

Enjoy!

-- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20150506/9466300d/attachment.html>



More information about the Python-Dev mailing list