Unyeilding a permutation generator

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Mon Nov 3 17:13:42 EST 2008


On Mon, 03 Nov 2008 21:09:58 +0000, Jorgen Grahn wrote:

> Why multi-threading?  I see no concurrency in the original algorithm.
> There is, in my mind, nothing concurrent about 'yield'.

No "real" concurrency but a generator can be seen as independent thread 
of code where the generator code is allowed to run when `next()` is 
called and stops itself when it ``yield``\s an object.  Sort of 
cooperative multitasking.  The name "yield" is often used in concurrent 
code like Java's or Io's `yield()` methods.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list