Opposite of yield?

Erik Max Francis max at alcyone.com
Thu Sep 11 00:17:33 CEST 2003


achrist at easystreet.com wrote:

> This style supports only output-driven processes.  The generator,
> being on the input side, is always the server, and the output
> side is always the client.  It doesn't fit the situation where the
> input is heterogeneous and input has to get spewed in several
> directions, depending on its content.

The distinction you're making is push vs. pull processing.  To get what
you want, you should use some sort of asynchronous mechanism with
synchronization when data is transferred.  Threading with the use of the
Queue module comes to mind immediately.  Other forms of asynchronous
processing are certainly possible, as well.

That being said, calling the next method of a generator _is_ the obvious
inverse process of a generator yielding a value.

-- 
   Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
 __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/  \ Forever we / Infinitely
\__/  Sandra St. Victor




More information about the Python-list mailing list